jQuery(document).ready(function ($){ "use strict"; $('.content-widget.products-carousel.tabs header.section-header ul li a').click(function (){ if(!$(this).parent().hasClass('active')){ var thisitem=$(this); var item_query=thisitem.attr('data-query'); var item_opts=thisitem.attr('data-opts'); var carousel_tag=thisitem.parents('.content-widget.products-carousel.tabs').find('.owl-carousel'); thisitem.parents('.content-widget.products-carousel.tabs').find('.loading').addClass('visible'); if(!thisitem.hasClass('loading')){ jQuery.post(negarshop_obj.ajax_url, { 'action': 'negarshop_ajax_tabcarousel', 'query': item_query, 'opts': item_opts, }, function (response){ if(response.status){ carousel_tag.trigger('destroy.owl.carousel'); carousel_tag.find('.owl-stage-outer').children().unwrap(); carousel_tag.removeClass("owl-center owl-loaded owl-text-select-on"); carousel_tag.html(response.data); var items=carousel_tag.attr('data-items'); var carOPTS=JSON.parse(carousel_tag.attr('data-carousel')); items=JSON.parse(items); carousel_tag.owlCarousel({ rtl: true, nav: carOPTS.nav, loop: carOPTS.loop, autoplay: carOPTS.autoplay, autoplayTimeout: 7000, autoplayHoverPause: false, dots: false, navText: ["",""], responsive: { 0: {items: items.sm,}, 480: {items: items.md,}, 700: {items: items.lg,}, 991: {items: items.xl,}, }, margin: 15 }); thisitem.parents('ul').find('li').removeClass('active'); thisitem.parent().addClass('active'); thisitem.parents('.content-widget.products-carousel.tabs').find('.loading').removeClass('visible'); } thisitem.removeClass('loading'); }); }} return false; }); }); jQuery(function($){ "use strict"; var variables={}; var request_sendable=true; var product_id=$('.woocommerce.single-product form.variations_form.cart').attr('data-product_id'); $('.woocommerce .variations_form.cart select.custom-select').each(function(){ var variable_name=$(this).attr("data-attribute_name"); var variable_value=$(this).val(); variables[variable_name]=variable_value; }); $('.woocommerce .variations_form.cart select.custom-select').change(function(){ var clock_selector=$('.woocommerce.single-product .sale-timer .flip-clock-a'); if($(this).val()!==""){ $('.woocommerce.single-product .sale-timer .negarshop-loading').show(); var variable_name=$(this).attr("data-attribute_name"); var variable_value=$(this).val(); variables[variable_name]=variable_value; var data_to_send={}; data_to_send=variables; data_to_send['product_id']=product_id; data_to_send['action']='negarshop_ajax_variable_product'; if(request_sendable){ request_sendable=false; jQuery.post(negarshop_obj.ajax_url, data_to_send, function(response){ if(response.status){ $('.woocommerce.single-product .sale-timer').slideDown('fast'); var discount=0; discount=parseInt(response.data.prices.reg) - parseInt(response.data.prices.sale); $('.woocommerce.single-product .sale-timer .left .discount span').text(accounting.formatMoney(discount, "", 0) + " " + response.data.prices.currency_symbol); var endTime=parseInt(response.data.dates.end) - parseInt(response.data.dates.now); clock_selector.html(""); clock_selector.removeAttr("class"); clock_selector.addClass("flip-clock-a"); var clock; clock=$('.woocommerce.single-product .sale-timer .flip-clock-a').FlipClock(endTime, { clockFace: 'DailyCounter', autoStart: false, language: 'fa', showSeconds: true, callbacks: { stop: function(){ window.location.assign('/'); }} }); clock.setCountdown(true); clock.start(); }else{ $('.woocommerce.single-product .sale-timer').slideUp('fast'); $('.woocommerce.single-product .sale-timer .left .discount span').text('-'); clock_selector.html(""); clock_selector.removeAttr("class"); clock_selector.addClass("flip-clock-a"); } $('.woocommerce.single-product .sale-timer .negarshop-loading').hide(); request_sendable=true; }); }}else{ $('.woocommerce.single-product .sale-timer').slideUp('fast'); $('.woocommerce.single-product .sale-timer .left .discount span').text('-'); clock_selector.html(""); clock_selector.removeAttr("class"); clock_selector.addClass("flip-clock-a"); }}); $('.woocommerce .variations_form.cart select.custom-select').change(); }); function setCookie(cname, cvalue, exdays, htime){ var d=new Date(); if(!htime){ d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); }else{ d.setTime(d.getTime() + (exdays * 60 * 60 * 1000)); } var expires="expires=" + d.toUTCString(); document.cookie=cname + "=" + cvalue + ";" + expires + ";path=/"; } function getCookie(cname){ var name=cname + "="; var ca=document.cookie.split(';'); for (var i=0; i < ca.length; i++){ var c=ca[i]; while (c.charAt(0)==' '){ c=c.substring(1); } if(c.indexOf(name)==0){ return c.substring(name.length, c.length); }} return ""; } function get(name){ if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec(location.search)) return decodeURIComponent(name[1]); } function insertParam(key, value){ key=encodeURI(key); value=encodeURI(value); var kvp=document.location.search.substr(1).split('&'); var i=kvp.length; var x; while(i--){ x=kvp[i].split('='); if(x[0]==key){ x[1]=value; kvp[i]=x.join('='); break; }} if(i<0){kvp[kvp.length]=[key,value].join('=');} document.location.search=kvp.join('&'); } function removeParam(key){ var sourceURL=window.location.href; var rtn=sourceURL.split("?")[0], param, params_arr=[], queryString=(sourceURL.indexOf("?")!==-1) ? sourceURL.split("?")[1]:""; if(queryString!==""){ params_arr=queryString.split("&"); for (var i=params_arr.length - 1; i >=0; i -=1){ param=params_arr[i].split("=")[0]; if(param===key){ params_arr.splice(i, 1); }} rtn=rtn + "?" + params_arr.join("&"); } document.location=rtn; return rtn; } function magnify(imgID, zoom){ var img, glass, w, h, bw; img=document.getElementById(imgID); glass=document.createElement("DIV"); glass.setAttribute("class", "img-magnifier-glass"); img.parentElement.insertBefore(glass, img); glass.style.backgroundImage="url('" + img.src + "')"; glass.style.backgroundRepeat="no-repeat"; glass.style.backgroundSize=(img.width * zoom) + "px " + (img.height * zoom) + "px"; bw=3; w=glass.offsetWidth / 2; h=glass.offsetHeight / 2; glass.addEventListener("mousemove", moveMagnifier); img.addEventListener("mousemove", moveMagnifier); glass.addEventListener("touchmove", moveMagnifier); img.addEventListener("touchmove", moveMagnifier); function moveMagnifier(e){ var pos, x, y; e.preventDefault(); pos=getCursorPos(e); x=pos.x; y=pos.y; if(x > img.width - (w / zoom)){x=img.width - (w / zoom);} if(x < w / zoom){x=w / zoom;} if(y > img.height - (h / zoom)){y=img.height - (h / zoom);} if(y < h / zoom){y=h / zoom;} glass.style.left=(x - w) + "px"; glass.style.top=(y - h) + "px"; glass.style.backgroundPosition="-" + ((x * zoom) - w + bw) + "px -" + ((y * zoom) - h + bw) + "px"; } function getCursorPos(e){ var a, x=0, y=0; e=e||window.event; a=img.getBoundingClientRect(); x=e.pageX - a.left; y=e.pageY - a.top; x=x - window.pageXOffset; y=y - window.pageYOffset; return {x:x, y:y};}} (function($){ "use strict"; var cookie_array=getCookie('img_banners'); if(cookie_array==""){ cookie_array=[]; }else{ cookie_array=JSON.parse(cookie_array); } $('.image-banner-parent.removeable').each(function(){ if(cookie_array.indexOf($(this).attr('id'))!="-1"){ $(this).hide() } $(this).append(''); }); $('.image-banner-parent.removeable button.close-btn').click(function(){ var thisParent=$(this).parents('.image-banner-parent.removeable'); cookie_array[cookie_array.length]=thisParent.attr("id"); setCookie("img_banners", JSON.stringify(cookie_array), 10, false); thisParent.slideUp(); }); $('.flip-clock-a').each(function(){ var endTime=parseInt($(this).attr('data-end')); var thisID=$(this).attr('id'); var clock; clock=$('#' + thisID).FlipClock(endTime, { clockFace: 'DailyCounter', autoStart: false, language: 'fa', showSeconds: true, callbacks: { stop: function(){ window.location.assign('/'); }} }); clock.setCountdown(true); clock.start(); }); $.fn.wc_product_def_gallery=jQuery('.product .woocommerce-product-gallery').html(); function CBinitProductGallery(){ var bigcar=$('.owl-carousel.wc-product-carousel'); var thumbcar=$('.single-style-2-gallery .owl-carousel.wc-product-carousel-thumbs'); $(document).ready(function (){ bigcar.owlCarousel({ items: 1, nav: true, dots: false, loop: false, navText: ["", ""] }); var items_thumbs=4; if(thumbcar.length>0){ items_thumbs=12 }else{ thumbcar=$('.owl-carousel.wc-product-carousel-thumbs'); } thumbcar.owlCarousel({ items: items_thumbs, center: true, margin: 10, nav: false, dots: false, }); bigcar.find('.owl-stage').lightGallery({ selector: '.car-dtag' }); bigcar.on('changed.owl.carousel', function (event){ thumbcar.trigger('to.owl.carousel', event.item.index); }); thumbcar.on('changed.owl.carousel', function (event){ bigcar.trigger('to.owl.carousel', event.item.index); }); $('.owl-carousel.wc-product-carousel-thumbs .owl-item').click(function (){ bigcar.trigger('to.owl.carousel', $(this).index()); }); }); bigcar.on('initialized.owl.carousel', function (event){ if($("body").hasClass("rtl")){ setTimeout(function (){ bigcar.trigger('to.owl.carousel', event.item.count - 1); }, 10); }}); if($(window).innerWidth() > 992){ $(document).ready(function (){ $('.owl-carousel.wc-product-carousel img.product-gallery-img').each(function (){ $('#' + $(this).attr('id')).one("load", function (){ $('#' + $(this).attr('id')).magnify({ speed: 200, src: $(this).attr('src') }); }).each(function (){ if(this.complete) $(this).load(); }); }); }); }} CBinitProductGallery(); var wcshortdesc=$('.woocommerce-product-details__short-description').height(); if(wcshortdesc > 194){ $('.woocommerce-product-details__short-description').append(''); } $('#product-short-desc-toggle').click(function(){ $(this).parents('.woocommerce-product-details__short-description').toggleClass('show'); if($(this).parents('.woocommerce-product-details__short-description').hasClass('show')){ $(this).children('span').text('کوتاه کردن'); }else{$(this).children('span').text('دیدن ادامه...');}}); $(document).ready(function (){ $('.enamad-carousel').owlCarousel({rtl: true, items: 1, loop: true, autoplay: true}); }); $('img.lazy').one("load", function(){ $(this).parents('figure.thumb').css({'background-image':'none'}); }).each(function(){ if(this.complete) $(this).load(); }); $(document).ready(function (){ $('.offer-moments .owl-carousel').each(function (){ var carouselSEL=$(this); var carinit=carouselSEL.owlCarousel({ items: 1, rtl: true, dots: false, touchDrag: false, mouseDrag: false, pullDrag: false, loop: true, nav: false, autoplay:true, autoplayTimeout:7000, autoplayHoverPause:false, onInitialized: function (){ carouselSEL.parents('.offer-moments').addClass('animate-bar'); }}); }); }); var afterval=0; wpbtt_start(); $(window).scroll(function(){ wpbtt_start(); if($(window).scrollTop() > 0){ $('.fixed-bottom-bar').fadeIn('fast'); }else{ $('.fixed-bottom-bar').fadeOut('fast'); }}); $("#main-menu-btn").click(function(){ $("#side-menu").addClass('show'); }); $("#res-search-btn").click(function(){ $(this).addClass('show'); }); $("#res-search-close").click(function(){ $("#res-search-btn").removeClass('show'); return false; }); $(".ui-mask").click(function(){ $("#side-menu").removeClass('show'); }); $("#side-menu nav li.menu-item-has-children,footer#footer .footer-copyright nav.footer-menu li.menu-item-has-children").each(function(){ $(this).children('a').after(''); }); $("#side-menu nav li.menu-item-has-children span.toggle").click(function(){ $(this).toggleClass('active'); $(this).next('ul').slideToggle('fast'); }); $("footer#footer .footer-copyright nav.footer-menu li.menu-item-has-children span.toggle").click(function(){ $(this).toggleClass('active'); $(this).next('ul').toggleClass('show'); }); $("button#footer-menu-toggle").click(function(){ $(this).next('ul').toggleClass('show'); }); $(".content-widget header.section-header button.wg-tabs-toggle").click(function(){ $(this).next('ul').toggleClass('show'); }); $(".content-widget header.section-header button.wg-tabs-close").click(function(){ $(this).parents('ul').removeClass('show'); }); $(".content-widget header.section-header ul.tabs a").click(function(){ $(this).parents('ul').removeClass('show'); }); var qiit=$('.woocommerce .quantity input.input-text'); qiit.each(function (){ $(this).before(''); $(this).after(''); $(this).parents('.quantity').addClass('custom-num'); $(this).show(); }); $(document).on('click','.woocommerce .quantity .m-btn',function(){ var inputT=$(this).parent().find('input.input-text'); if(parseInt(inputT.val()) > parseInt(inputT.attr('min'))){ inputT.val(parseInt(inputT.val()) - 1); inputT.change(); }}); $(document).on('click','.woocommerce .quantity .p-btn',function(){ var inputT=$(this).parent().find('input.input-text'); if(parseInt(inputT.val()) >=parseInt(inputT.attr('min'))){ inputT.val(parseInt(inputT.val()) + 1); inputT.change(); }}); $(document).ajaxSuccess(function(event, xhr, settings){ var req_url=settings.url; if(req_url.search("wc-ajax=get_refreshed_fragments") > -1){ $('.woocommerce .quantity input.input-text').parents('.quantity').addClass('custom-num'); $('.woocommerce .quantity.custom-num input.input-text').before(''); $('.woocommerce .quantity.custom-num input.input-text').after(''); $('.woocommerce .quantity input.input-text').show(); }}); if($('.orderby.custom-select').length>0){ $('.sort-tabs ul.products-archive-tabs button[data-value="' + $('.orderby.custom-select').val() + '"]').addClass('btn-primary'); $('.sort-tabs ul.products-archive-tabs button:not(.btn-primary)').click(function (){ $('.orderby.custom-select').val($(this).attr('data-value')); $('.orderby.custom-select').change(); }); }else{ $('.woocommerce-products-header .sort-tabs').remove(); } if(get('stock')=="instock"){ $('#archive-in-stock-switch').prop('checked', true); } $('#archive-in-stock-switch').change(function(){ if($(this).prop("checked")){ insertParam('stock', 'instock'); }else{ removeParam('stock'); }}); if(getCookie('negarshop_popup')!="hidden"){ $('#negarshop-popup').modal('show'); } $('#negarshop-popup .negarshop-popup-link').click(function(){ var cook_time=$('#negarshop-popup').attr('data-time'); setCookie('negarshop_popup','hidden',cook_time,true); $('#negarshop-popup').modal('hide'); }); $('#negarshop-popup').on('hidden.bs.modal', function (e){ var cook_time=$('#negarshop-popup').attr('data-time'); setCookie('negarshop_popup','hidden',cook_time,true); }); $('#header-action-menu-btn').click(function(){ $(this).toggleClass('active'); $('header#header.style-negarshop-light .bottom').toggleClass('show'); }); function wpbtt_btn(i){ var prec=i * 3.6; if(prec <=180){ jQuery('#negarshop-to-top>span').css('background-image', 'linear-gradient(' + (prec + 90) + 'deg, transparent 50%, #fff 50%),linear-gradient(90deg, #fff 50%, transparent 50%)'); }else{ jQuery('#negarshop-to-top>span').css('background-image', 'linear-gradient(' + (prec - 90) + 'deg, transparent 50%, ' + jsVars.borderActiveColor + ' 50%),linear-gradient(90deg, #fff 50%, transparent 50%)'); }} function wpbtt_start(){ var scrollTop=jQuery(window).scrollTop(); var docHeight=jQuery(document).height(); var winHeight=jQuery(window).height(); var scrollPercent=(scrollTop) / (docHeight - winHeight); var scrollPercentRounded=Math.round(scrollPercent * 100); wpbtt_btn(scrollPercentRounded); } $('#negarshop-to-top').click(function(){ $("html, body").stop().animate({ scrollTop: 0 }, "fast"); return false; }); $('.products-grid .grid-products-loader button.btn').click(function(){ var thisItem=$(this); var ti_offset=parseInt($(this).attr('data-offset')); thisItem.addClass('disabled'); jQuery.post(negarshop_obj.ajax_url, { 'action': 'negarshop_grid_post_ajax', 'query': thisItem.attr('data-query'), 'offset': ti_offset, }, function(response){ if(response.status){ ti_offset++; thisItem.attr('data-offset', ti_offset); thisItem.removeClass('disabled'); thisItem.parents('.grid-items').children('.row').append(response.data); if(!response.next){thisItem.remove();}} }); return false; }); var caloadmg=false; $('#magical-btn').click(function(){ var thisItem=$(this); $('.magic-items').slideUp('fast'); thisItem.addClass('loading'); jQuery.post(negarshop_obj.ajax_url, { 'action': 'negarshop_magic_post_ajax', 'query': thisItem.attr('data-query'), }, function(response){ if(response.status){ $('.magic-items').slideDown('fast'); $("html, body").animate({ scrollTop: $('.magic-items').offset().top }, "slow"); $('.magic-items .row').html(response.data); } thisItem.removeClass('loading'); }); return false; }); $(document).on("click", ".add-product-favo, .dislike_product", function(){ var thisItem=$(this); if(!thisItem.hasClass('login_req')){ thisItem.addClass('disabled'); jQuery.post(negarshop_obj.ajax_url, { 'action': 'negarshop_like_ajax', 'id': thisItem.attr('data-id'), }, function (response){ if(response.status){ if(response.status_code==1){ thisItem.addClass("liked"); }else if(response.status_code==2){ thisItem.removeClass("liked"); } thisItem.removeClass('disabled'); if(thisItem.hasClass('dislike_product')){ location.reload(); }} }); }else{ $('#login-popup-modal').modal('show'); } return false; }); $(document).on("click", ".cb-quick-view:not(.disabled)", function(){ var thisItem=$(this); var cbQVModal=$('.cb-quick-view-modal-lg'); thisItem.addClass('disabled'); cbQVModal.find('.modal-content').children('.loading').show(); cbQVModal.find('.modal-content').children('.content').html(''); cbQVModal.modal('show'); jQuery.post(negarshop_obj.ajax_url, { 'action': 'cb_quick_view_ajax', 'id': thisItem.attr('data-id'), }, function(response){ if(response.status){ cbQVModal.find('.modal-content').children('.loading').hide(); cbQVModal.find('.modal-content').children('.content').html(response.data); thisItem.removeClass('disabled'); }}); return false; }); $(document).on("click", '.cb-add-to-cart', function(){ var thisitem=$(this); thisitem.addClass('disabled'); $.ajax({ url: negarshop_obj.ajax_url, method: 'post', data:{ 'action': 'cb_add_to_cart_ajax', 'id': thisitem.attr('data-id'), }}).done(function (response){ if(response.status!==undefined){ $.notify({ message: response.message, }, { element: 'body', position: null, type: response.style, allow_dismiss: false, newest_on_top: false, placement: { from: "top", align: "right" }, z_index: parseInt(thisitem.attr('data-offset')), delay: 2000, timer: 1000, }); $('.widget_shopping_cart_content').html(response.basket); $('.cart-basket-box span.count, #responsive-header .rh-item .badge').text(response.count); $('.cart-basket-box span.subtitle').html(response.total_amount); } thisitem.removeClass('disabled'); }); }); $("html").click(function(){ $(".header-search .search-box.ajax-form .search-result").fadeOut('fast'); }); $(".header-search .search-box.ajax-form .search-result").click(function(a){ a.stopPropagation(); }); $('.header-search .search-box.ajax-form input.search-field').focus(function(a){ a.stopPropagation(); $(this).parents('.search-box').find('.search-result').fadeIn('fast'); }).click(function(a){ a.stopPropagation(); $(this).parents('.search-box').find('.search-result').fadeIn('fast'); }); var pretext=$('.header-search .search-box.ajax-form input.search-field').val(); var forceSearch=false; var current_category,current_instuck; $('.header-search .search-box.ajax-form .close-popup, .header-search .search-box.ajax-form .search-submit').click(function(){ forceSearch=true; current_category=$(this).parents('.search-box').find('#header-search-cat').val(); current_instuck=$(this).parents('.search-box').find('#header-search-stock').val(); $('.header-search .search-box input.search-field').keyup(); return false; }); var cansend=true; var myTimeVar; $('.header-search .search-box.ajax-form input.search-field').keyup(function(){ clearTimeout(myTimeVar); var thisItem=$(this); var current_text=$(this).val(); thisItem.parents('.search-box').addClass('loading'); myTimeVar=setTimeout(function(){ var content_selector=thisItem.parents('.search-box').find('.search-result'); var current_type=thisItem.parents('.search-box').attr('data-type'); current_category=thisItem.parents('.search-box').find('#header-search-cat').val(); current_instuck=thisItem.parents('.search-box').find('#header-search-stock')!==undefined?thisItem.parents('.search-box').find('#header-search-stock').val():''; if(cansend&&(current_text!=pretext||forceSearch)&¤t_text!=""&¤t_text.length > 1){ cansend=false; forceSearch=false; content_selector.html(''); jQuery.post(negarshop_obj.ajax_url, { 'action': 'negarshop_ajax_search', 's': thisItem.val(), 'cat': current_category, 'stuck': current_instuck, 'type': current_type, }, function(response){ if(response.status){ var html_output=''; var i; var res_data=response.data; if(res_data.length > 0){ for(i=0; i< res_data.length; i++){ html_output=html_output + '
  • '+res_data[i].title+'

    '+res_data[i].title+'

    '+res_data[i].price+'
  • '; } html_output +='
  • '+defaultText.searchArchive+''+defaultText.searchAllBtn+'
  • '; }else{ html_output='
  • '+defaultText.searchNotFound+'
  • '; } content_selector.fadeIn('fast'); content_selector.html(html_output); thisItem.parents('.search-box').removeClass('loading'); } cansend=true; }); }else{ thisItem.parents('.search-box').removeClass('loading'); } pretext=current_text; }, 1000); }); $('.negar-select').each(function (){ $(this).select2(); }); $('.header-search .search-box button.search-filters').click(function (){ $(this).parents('.search-box').addClass('show-filters'); }); $('.header-search .search-box button.close-popup').click(function (){ $(this).parents('.search-box').removeClass('show-filters'); }); function initOWLCAR(selector){ selector.each(function(){ var owlSelector=$(this); var owlOptions={}; if(owlSelector.attr('data-owl-options')!==undefined){ owlOptions=JSON.parse(owlSelector.attr('data-owl-options')); } owlSelector.owlCarousel(owlOptions); }); } $(document).ready(function (){ initOWLCAR($('.inline-owl-carousel')); }); $(document).on('mouseenter', '.is-mega-menu-con.is-product-mega-menu .tabs a[data-query],.is-mega-menu-con.is-two-level-mega-menu .tabs a[data-query]',function(){ var thisitem=$(this); thisitem.parents('.tabs').find('a').removeClass('item-hover'); thisitem.addClass('item-hover'); var menu_tab=thisitem.attr('data-tab'); var content=thisitem.parents('.is-mega-menu-con').find('.contents'); content.addClass('loading'); if(!$(this).hasClass('loaded')){ var menu_query=thisitem.attr('data-query'); if(!thisitem.hasClass('loading')){ thisitem.addClass('loading'); content.find('.owl-carousel').removeClass('show'); jQuery.post(negarshop_obj.ajax_url, { 'action': 'negarshop_ajax_megamenu_producs', 'query': menu_query, 'tab': menu_tab }, function(response){ if(response.status){ content.append(response.data.htmlContent); content.find('.tab-'+menu_tab).addClass('show'); initOWLCAR(content.find('.tab-'+response.data.classAttr)); thisitem.addClass('loaded'); } thisitem.removeClass('loading'); content.removeClass('loading'); thisitem.trigger('mouseenter'); }); }}else{ content.removeClass('loading'); content.find('.owl-carousel').removeClass('show'); content.find('.tl-tabs').removeClass('show'); content.find('.tab-'+menu_tab).removeClass('owl-hidden'); content.find('.tab-'+menu_tab).addClass('show'); }}); $('ul.main-menu li[data-id]').hover(function(){ if(!$(this).hasClass('loaded')){ var thisitem=$(this); var menu_id=thisitem.attr('data-id'); if(!thisitem.hasClass('loading')){ thisitem.addClass('loading'); jQuery.post(negarshop_obj.ajax_url, { 'action': 'negarshop_ajax_megamenu', 'menu_id': menu_id }, function(response){ if(response.status){ thisitem.append(response.data); thisitem.addClass('loaded'); if(response.type==="product"){ thisitem.find('.tabs li:first-of-type>a').trigger('mouseenter'); } $('.header-main-nav .header-main-menu:not(.vertical-menu) li[data-id]>ul.is-mega-menu-con').width($('.container').width()-20); $('.header-main-nav .header-main-menu.vertical-menu li[data-id]>ul.is-mega-menu-con').width($('.container').width()-275); } thisitem.removeClass('loading'); }); }} }); $('.header-main-nav .header-main-menu ul.main-menu>li.loaded>a').each(function (){ if($(this).prev('ul').length==1){ var html_OUT=$(this).context.outerHTML; $(this).prev('ul').before(html_OUT); $(this).prev('ul').find('.tabs ul>li:first-of-type>a').trigger('mouseenter'); $(this).remove(); var contSize=$('.container').width(); $('.header-main-nav .header-main-menu:not(.vertical-menu) li[data-id]>ul.is-mega-menu-con').width($('.container').width()-20); }}); $('.header-main-nav .header-main-menu.vertical-menu li[data-id]>ul.is-mega-menu-con').each(function(){ if($(this).offset().left<0){ $(this).width($(this).width() + $(this).offset().left - 15); }}); $('video[custom-control]').each(function (){ $(this).after(''); }); $('video[custom-control]+.btn-play').on("click",function (){ if($(this).find('i').hasClass('fa-pause')){ $(this).prev("video").get(0).pause(); }else{ $(this).prev("video").get(0).play(); } $(this).find('i').toggleClass("fa-pause"); }); $("#res-search-show").click(function(){ $('.res-searchform').addClass('active'); }); $("#res-search-close").click(function(){ $('.res-searchform').removeClass('active'); }); $("#header-menu-toggle").click(function(){ $(".side-nav").addClass('show'); }); $(".ui-mask").click(function(){ $(".side-nav").removeClass('show'); }); $(".side-nav nav li.menu-item-has-children, #footer .footer-menu nav.footer-menu li.menu-item-has-children").each(function(){ $(this).children('a').after(''); }); $(".side-nav nav li.menu-item-has-children span.toggle, #footer .footer-menu nav.footer-menu li.menu-item-has-children span.toggle").click(function(){ $(this).toggleClass('active'); $(this).next('ul').slideToggle('fast'); }); $(window).scroll(function (){ if($(this).width() < 1200){ if($(this).scrollTop() > 15){ $('#responsive-header').addClass('fixed'); }else{ $('#responsive-header').removeClass('fixed'); }} }); $('#send-product-email').on("click", function (){ var thisitem=$(this); var post_id=thisitem.attr('data-id'); var user_email=$('#share-email-address').val(); if(!thisitem.hasClass('disabled')){ thisitem.addClass('disabled'); jQuery.post(negarshop_obj.ajax_url, { 'action': 'negarshop_email_sharing', 'id': post_id, 'email': user_email, }, function (response){ var res=defaultText.errorSend; var style="error"; if(response.status){ res=response.data; style="success"; } $.notify({ message: res, }, { element: 'body', position: null, type: style, allow_dismiss: false, newest_on_top: false, placement: { from: "top", align: "right" }, z_index: 9999, delay: 2000, timer: 1000, }); thisitem.removeClass('disabled'); }); }}); $(document).ready(function (){ $('.product-additional-items .owl-carousel').owlCarousel({ rtl: true, nav: true, dots:false, navText: ["",""], responsive:{ 0:{ items:1, }, 480:{ items:1, }, 700:{ items:2, }, 991:{ items:2, }, }, margin: 20 }); }); if($('.af-add-to-cart .btn').length > 0){ var AF_cansend=true; var af_add=$('.af-add-to-cart .btn'); var af_sel=$(".product-additional-items .additional-factor"); var af_items_sel=$(".product-additional-items input[name*='quantity[']"); var af_total_sel=$(".product-additional-items .af-total-price .total-count b"); var af_items_sel_count=af_items_sel.length; af_items_sel.on("change", function (){ var af_total_price=0; var item_ID=parseInt($(this).attr("data-id")); if($(this)[0].checked){ $(this).attr("value","1"); af_items_sel_count++; }else{ $(this).attr("value","0"); af_items_sel_count--; } if(af_items_sel_count==1){ $(".product-additional-items input[name*='quantity[']:checked").addClass('disabled'); }else{ $(".product-additional-items input[name*='quantity['].disabled").removeClass('disabled'); } if(AF_cansend){ af_items_sel.each(function (){ if($(this)[0].checked){ af_total_price +=parseInt($(this).attr("data-price")); }}); AF_cansend=false; af_sel.addClass('loading'); jQuery.post(negarshop_obj.ajax_url, { 'action': 'negarshop_price_html', 'int': af_total_price, }, function (response){ if(response){ af_total_sel.text(af_items_sel_count); $('.product-section.product-additional-items .additional-factor .af-total-price .price').html(response.data); } af_sel.removeClass('loading'); AF_cansend=true; }); }}); } function arrayEdit(array,item,add){ if(add){ var exist=false; for (var KEY in array){ if(array[KEY]===item){ exist=true; }} if(!exist){array[array.length]=item;}}else{ for (var KEY in array){ if(array[KEY]===item){ array.splice(KEY, 1); }} } return array; } $('.cb-nouislider').each(function (){ var bigValueSlider=$(this).get(0); var slider=noUiSlider.create(bigValueSlider, { start: 3, step: 1, connect: [true, false], direction: 'rtl', range: { min: 1, max: 5 }}); $(this).append(''); $(this).append(''+defaultText.medium+''); var input_value=$(this).find('input'); var level_text=$(this).find('.level'); bigValueSlider.noUiSlider.on('slide.one', function (a){ input_value.val(parseInt(a[0])); switch (parseInt(a[0])){ case 2: level_text.text(defaultText.bad); break; case 3: level_text.text(defaultText.medium); break; case 4: level_text.text(defaultText.good); break; case 5: level_text.text(defaultText.excelent); break; default: level_text.text(defaultText.verybad); break; }}); }); $('.cb-chips').each(function (){ $(this).append('
    '); $(this).append('
    '); $(this).append(''); $(this).append('
    '); }); $(document).on("keypress",".cb-chips input.text-field",function (e){ if(e.which==13){ $(this).parents('.add-box').find('.add-item').click(); return false; }}); $(document).on("click",".cb-chips .add-box .add-item",function (){ var parent=$(this).parents('.cb-chips'); var txt_inp=parent.find('.text-field').val(); if(txt_inp!==""){ var div=document.createElement("div"); div.innerHTML=txt_inp; parent.find('.chip-items').prepend('
  • ' + div.innerText + '
  • '); parent.find('.text-field').val(""); }}); $(document).on("click",".cb-chips .chip-items .remove-item",function (){ $(this).parents('li').remove(); }); $('.comment-form-cookies-consent').addClass('ns-checkbox'); function exLikes(){ $('.comment-like-btn').each(function (){ var id=$(this).attr('data-id'); var cookie_name="comment_like_btn"; var cookie=getCookie(cookie_name); if(cookie===""){cookie=[];}else{cookie=JSON.parse(cookie);} var rate_exists=jQuery.inArray(id, cookie); if(rate_exists >=0){ $(this).addClass('disabled'); }}); } $(document).on("click", ".comment-like-btn", function (){ var thisitem=$(this); var cookie_name="comment_like_btn"; var cookie=getCookie(cookie_name); if(cookie===""){cookie=[];}else{cookie=JSON.parse(cookie);} var rate_exists=jQuery.inArray(thisitem.attr('data-id'), cookie); if(rate_exists===-1){ if(cookie.length===0){ cookie[0]=thisitem.attr('data-id'); cookie=JSON.stringify(cookie); setCookie(cookie_name, cookie, 30, false); }else{ cookie[cookie.length]=thisitem.attr('data-id'); cookie=JSON.stringify(cookie); setCookie(cookie_name, cookie, 30, false); } if(!thisitem.hasClass('disabled')){ thisitem.addClass('disabled'); $.post(negarshop_obj.ajax_url, { 'action': 'cb_comment_rates', 'id': thisitem.attr('data-id'), 'act': thisitem.attr('data-action'), }, function (response){ if(response.status){ thisitem.find('.count').text(response.data); exLikes(); } $('.comment-like-btn[data-id="'+thisitem.attr('data-id')+'"]').addClass('disabled'); }); }}else{ thisitem.addClass('disabled'); }}); $('.cb-comment-tabs .cb-tabs a').click(function (){ var thisitem=$(this); if(!thisitem.hasClass('disabled')&&!thisitem.hasClass('active')){ thisitem.addClass('disabled'); $('.cb_comment_list').addClass('loading'); $.post(negarshop_obj.ajax_url, { 'action': 'cb_comment_tabs', 'id': thisitem.attr('data-id'), 'order': thisitem.attr('data-order'), }, function (response){ if(response.status){ $('.cb_comment_list .commentlist').html(response.data); $('.cb-comment-tabs .cb-tabs a').removeClass('active'); thisitem.addClass('active'); exLikes(); } $('.cb_comment_list').removeClass('loading'); thisitem.removeClass('disabled'); }); } return false; }); $('.cb-comment-tabs .cb-tabs li:first-of-type a').click(); var rltpro=4; if($('body').hasClass('wide-style')){ rltpro=5; } $(document).ready(function (){ $('.related.products-carousel .owl-carousel').owlCarousel({ rtl: true, nav: true, dots:false, loop: true, navText: ["",""], responsive:{ 0:{ items:1, }, 360:{ items:1.5, }, 480:{ items:2, }, 700:{ items:3, }, 991:{ items:rltpro, }, }, margin: 15 }); }); var checkSending=false; $("#login-remember").change(function (event){ if($(this).is(":checked")){ $(this).val(1); }else{ $(this).val(0); }}); $("#login-submit").click(function (){ var thisitem=$(this); var data=$(this).parents('.header-popup-login').serialize(); var username=$("#login-username").val(); var password=$("#login-pass").val(); var remember=$("#login-remember").val(); if(username!==""&&password!==""){ thisitem.attr("disabled", true); $("#login-res").text(defaultText.pleaseWait); $("#login-res").addClass("d-block"); if(!checkSending){ checkSending=true; jQuery.post(negarshop_obj.ajax_url, { 'action': 'negarshop_ajax_login', 'username': username, 'password': password, 'remember': remember, 'other': data }, function (response){ $("#login-res").text(response.data); $("#login-res").addClass(response.type); if(response.status===true){ location.reload(); } thisitem.attr("disabled", false); checkSending=false; }); }} return false; }); $('form.header-popup-login input').on('keypress',function (e){ if(e.which==13){ $("#login-submit").trigger('click'); }}); $(".variations_form.cart select").each(function (){ $(this).addClass('form-control'); }); $(".dokan-btn, .sms-notif-submit").each(function (){ $(this).removeClass('dokan-btn'); $(this).addClass('btn'); }); $(".dokan-btn-theme, .sms-notif-submit").each(function (){ $(this).removeClass('dokan-btn-theme'); $(this).addClass('btn-primary'); }); $('#yith-wcwtl-output .button').addClass('btn'); $('.summary.entry-summary #yith-wcwtl-output').remove(); $('ul.product-categories li.cat-parent>a').on("click",function(){ $(this).next("ul").slideToggle("fast"); $(this).parents('li').toggleClass('open'); return false; }); $('[data-toggle="tooltip"]').tooltip(); $(document).on('click', '.ns-popup-btn', function (){ var mdl_selector=$(this).attr('data-toggle'); $(mdl_selector).addClass('active'); }); $(document).on('click', '.ns-popup-close', function (){ $(this).parents('.ns-popup').removeClass('active'); }); $(document).on('click', '.ns-closer', function (){ $(this).prev('.ns-popup').removeClass('active'); }); $('.sec-sticky').each(function (){ var thisIitem=$(this); $(this).after('
    '); if($(window).width()>991){ var firstOff=thisIitem.offset().top; $(window).scroll(function (){ var item=thisIitem; if($(window).scrollTop() >=firstOff){ if(!item.hasClass('fixed')){ item.addClass('fixed'); }}else{ if(item.hasClass('fixed')){ item.removeClass('fixed'); }} }); }}); $(document).ready(function($){ if($.isFunction(window.background)){ $('.background-video').background(); }}); $.fn.wc_variations_current=false; $.fn.wc_variations_image_update=function(variation){ var $form=this; if(variation&&variation.cb_var_gallery&&variation.cb_var_gallery.length > 1){ $.fn.wc_gallery_items_count=variation.cb_var_gallery.length; var html_output=''; html_output +=''; if($.fn.wc_variations_current!==html_output){ jQuery('.product .woocommerce-product-gallery').html(html_output); CBinitProductGallery(); } $.fn.wc_variations_current=html_output; }else{ if($.fn.wc_variations_current!==$.fn.wc_product_def_gallery){ $form.wc_variations_image_reset(); }} window.setTimeout(function (){ $(window).trigger('resize'); $form.wc_maybe_trigger_slide_position_reset(variation); $('.owl-carousel.wc-product-carousel').trigger('to.owl.carousel', 100); }, 20); }; $.fn.wc_variations_image_reset=function(){ if($.fn.wc_variations_current!==$.fn.wc_product_def_gallery){ jQuery('.product .woocommerce-product-gallery').html($.fn.wc_product_def_gallery); CBinitProductGallery(); } $.fn.wc_variations_current=$.fn.wc_product_def_gallery; }; $('.horz-res-scroll').each(function (){ $(this).wrap('
    '); var outer=$(this).parent(); outer.append(''); outer.prepend(''); }); $('.hrs-outer .hts-btn').click(function (){ var tag=$(this).parent().find('.horz-res-scroll'); var ts=$(this); if($(this).hasClass('hrs-next-btn')){ tag.stop().animate({scrollLeft: tag.scrollLeft()-100}, 400, function (){ if(tag.scrollLeft()>=0){ ts.parent().find('.hrs-prev-btn').fadeOut('fast'); }else{ ts.parent().find('.hrs-prev-btn').fadeIn('fast'); }}); }else{ tag.stop().animate({scrollLeft: tag.scrollLeft()+100}, 400, function (){ if(tag.scrollLeft()>=0){ ts.parent().find('.hrs-prev-btn').fadeOut('fast'); }else{ ts.parent().find('.hrs-prev-btn').fadeIn('fast'); }}); }}); $(document).on('click','.sidebar.shop-archive-sidebar.acc-widgets section.widget:not(.show)',function (){ $('.sidebar.shop-archive-sidebar.acc-widgets section.widget.show').not(this).children('*:not(.wg-header)').slideUp('fast'); $('.sidebar.shop-archive-sidebar.acc-widgets section.widget.show').not(this).removeClass('show'); $(this).children('*').slideDown('fast'); $(this).addClass('show'); }); $(document).ready(function (){ setTimeout(function (){ $('.carousel .carousel-item img:not(.loaded)').each(function (){ $(this).attr("src",$(this).attr("data-src")); $(this).addClass('loaded'); }); },1000); $('#shipping_city, #billing_city').addClass('form-control'); $('.negarshop-countdown').each(function (){ var date='0000/00/00'; if($(this).attr("data-date")!==undefined){ date=$(this).attr("data-date"); } $(this).countdown(date, function(event){ $(this).html(event.strftime('
    %Dروز%Hساعت%Mدقیقه%Sثانیه
    ')); }); }); }); $('.crunchify-clipboard').click(function (){ var copyText=document.getElementById("product-url-inpt"); copyText.select(); copyText.setSelectionRange(0, 99999); document.execCommand ("copy"); }); $(document).on('click','.shop-archive-sidebar .section-close',function (){ $(this).parents('.shop-archive-sidebar').removeClass('show'); return false; }); $(document).on('click','.shop-filters-show',function (){ $('.shop-archive-sidebar').addClass('show'); return false; }); $(document).on('submit','#product-survey-form',function (){ if($("body").hasClass('logged-in')){ var formData={}; formData['action']='negarshop_product_survey_ajax'; formData['answ']='no'; $(this).find("input[name]").each(function (index, node){ formData[node.name]=node.value; }); if((formData['desc1']!==undefined&&formData['desc1']!=="")||(formData['desc2']!==undefined&&formData['desc2']!=="")){ var self=$(this); self.addClass('loading'); jQuery.post(negarshop_obj.ajax_url, formData, function (response){ self.removeClass('loading'); if(response.status){ $('#product-survey').modal('hide'); self.remove(); $('.entry-summary .product-survey').addClass('sent'); }else{ $.notify({ message: response.data, }, { element: 'body', position: null, type: 'error', allow_dismiss: false, newest_on_top: false, placement: { from: "top", align: "right" }, z_index: 9999, delay: 2000, timer: 1000, }); }}); }}else{ $('#login-popup-modal').modal('show'); } return false; }); $(document).on('click','.product-survey .btn.yes',function (){ if($("body").hasClass('logged-in')){ var formData={}; formData['action']='negarshop_product_survey_ajax'; formData['answ']='yes'; formData['product']=$(this).attr('data-product'); var self=$(this).parents('.product-survey'); self.addClass('loading'); jQuery.post(negarshop_obj.ajax_url, formData, function (response){ self.removeClass('loading'); if(response.status){ self.addClass('sent'); }else{ $.notify({ message: response.data, }, { element: 'body', position: null, type: 'error', allow_dismiss: false, newest_on_top: false, placement: { from: "top", align: "right" }, z_index: 9999, delay: 2000, timer: 1000, }); }}); }else{ $('#login-popup-modal').modal('show'); } return false; }); $('.woocommerce nav.woocommerce-MyAccount-navigation ul li.res-toggle-menu').click(function (){ $(this).toggleClass('show'); return false; }); $('#login-popup-modal').on('show.bs.modal', function (e){ if(!$("body").hasClass('pop-up-login')){ window.location.href=negarshop_obj.my_account; return false; }}); })(jQuery); function archive_btn(){ jQuery('.header-search form.form-tag').submit(); } jQuery(document).ready(function(a){"use strict";a(".show-ywsl-box").on("click",function(b){b.preventDefault(),a(".ywsl-box").slideToggle()}),"#_=_"==window.location.hash&&(history.replaceState?history.replaceState(null,null,window.location.href.split("#")[0]):window.location.hash="")}); jQuery(document).ready(function(a){"use strict";var b=function(){var b=a(document).find("#yith-wcwtl-email"),c=b.parents("#yith-wcwtl-output").find("a.button"),d=c.attr("href");b.length&&b.on("input",function(a){var e=b.val(),f=b.attr("name");c.prop("href",d+"&"+f+"="+e)})};b(),a("form.variations_form").on("show_variation",b),a(document).on("qv_loader_stop",b)}); jQuery(function($){ "use strict"; $('.price-changes button.cb-change-filter-btn').click(function(){ var this_item=$(this); this_item.addClass('disabled'); this_item.parents('.price-changes').find('table').addClass('loading'); jQuery.post(negarshop_obj.ajax_url, { 'action': 'negarshop_price_change_ajax', 'query': { 'cat': this_item.parents('.cb-filters').find('select.cb-change-wc-cats').val(), 'ppp': this_item.parents('.cb-filters').find('select.cb-change-wc-ppp').val(), 'columns': this_item.attr('data-columns'), 'date': this_item.attr('data-date'), 'stock': this_item.parents('.cb-filters').find('.cb-change-wc-stock').is(":checked") }, }, function(response){ if(response.status){ this_item.parents('.price-changes').find('table').find('tbody').html(response.data); this_item.parents('.price-changes').find('.scrollbar-price').mCustomScrollbar(); } this_item.parents('.price-changes').find('table').removeClass('loading'); this_item.removeClass('disabled'); }); return false; }); $('.price-changes button.cb-change-filter-btn').click(); }); window.addComment=function(u){var v,y,p,f=u.document,I={commentReplyClass:"comment-reply-link",cancelReplyId:"cancel-comment-reply-link",commentFormId:"commentform",temporaryFormId:"wp-temp-form-div",parentIdFieldId:"comment_parent",postIdFieldId:"comment_post_ID"},e=u.MutationObserver||u.WebKitMutationObserver||u.MozMutationObserver,i="querySelector"in f&&"addEventListener"in u,n=!!f.documentElement.dataset;function t(){r(),e&&new e(d).observe(f.body,{childList:!0,subtree:!0})}function r(e){if(i&&(v=h(I.cancelReplyId),y=h(I.commentFormId),v)){v.addEventListener("touchstart",a),v.addEventListener("click",a);var t=function(e){if((e.metaKey||e.ctrlKey)&&13===e.keyCode)return y.removeEventListener("keydown",t),e.preventDefault(),y.submit.click(),!1};y&&y.addEventListener("keydown",t);for(var n,r=function(e){var t=I.commentReplyClass;e&&e.childNodes||(e=f);t=f.getElementsByClassName?e.getElementsByClassName(t):e.querySelectorAll("."+t);return t}(e),d=0,o=r.length;d
    \n' + ' \n' + ' \n' + ' \n' + '
    '); initModFile(response.data.m,response.data.t,response.data.c); fullloaded=true; }}); }} $(document).on("click","#view-3d-controller .btn-fullscreen",function(){ var e=document.getElementById("canvas-container-3d"); document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement ? (document.exitFullscreen ? document.exitFullscreen():document.msExitFullscreen ? document.msExitFullscreen():document.mozCancelFullScreen ? document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen(), $(".full_screen_ic").removeClass("normal")):(e.requestFullscreen ? e.requestFullscreen():e.msRequestFullscreen ? e.msRequestFullscreen():e.mozRequestFullScreen ? e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT), $("#view-3d-controller .btn-fullscreen").addClass("normal")) }); })(jQuery); function initModFile(m,t,c){ V3Dviewer(m,t,c); try { THREE.TextureLoader.prototype={ constructor: THREE.TextureLoader, load: function (url, onLoad, onProgress, onError){ var texture=new THREE.Texture(); var loader=new THREE.ImageLoader(this.manager); loader.setCrossOrigin('*'); loader.load(url, function (image){ texture.image=image; texture.needsUpdate=true; if(onLoad!==undefined){ onLoad(texture); }}, onProgress, onError); return texture; }, setCrossOrigin: function (value){ this.crossOrigin=value; }}; create3d(); } catch (e){ console.log("F", e); }}; (function($){ $.fn.magnify=function(oOptions){ oOptions=$.extend({ 'src': '', 'speed': 100, 'timeout': -1, 'touchBottomOffset': 0, 'finalWidth': null, 'finalHeight': null, 'magnifiedWidth': null, 'magnifiedHeight': null, 'limitBounds': false, 'mobileCloseEvent': 'touchstart', 'afterLoad': function(){}}, oOptions); var $that=this, $html=$('html'), init=function(el){ var $image=$(el), $anchor=$image.closest('a'), oDataAttr={}; for (var i in oOptions){ oDataAttr[i]=$image.attr('data-magnify-' + i.toLowerCase()); } var sZoomSrc=oDataAttr['src']||oOptions['src']||$anchor.attr('href')||''; if(!sZoomSrc) return; var $container, $lens, nImageWidth, nImageHeight, nMagnifiedWidth, nMagnifiedHeight, nLensWidth, nLensHeight, nBoundX=0, nBoundY=0, nPosX, nPosY, nX, nY, oContainerOffset, oImageOffset, getOffset=function(){ var o=$container.offset(); oImageOffset={ 'top': ($image.offset().top-o.top) + parseInt($image.css('border-top-width')) + parseInt($image.css('padding-top')), 'left': ($image.offset().left-o.left) + parseInt($image.css('border-left-width')) + parseInt($image.css('padding-left')) }; o.top +=oImageOffset['top']; o.left +=oImageOffset['left']; return o; }, hideLens=function(){ if($lens.is(':visible')) $lens.fadeOut(oOptions['speed'], function(){ $html.removeClass('magnifying').trigger('magnifyend'); }); }, moveLens=function(e){ if(!nImageHeight){ refresh(); return; } if(e){ e.preventDefault(); nPosX=e.pageX||e.originalEvent.touches[0].pageX; nPosY=e.pageY||e.originalEvent.touches[0].pageY; $image.data('lastPos', { 'x': nPosX, 'y': nPosY }); }else{ nPosX=$image.data('lastPos').x; nPosY=$image.data('lastPos').y; } nX=nPosX - oContainerOffset['left'], nY=(nPosY - oContainerOffset['top']) - oOptions['touchBottomOffset']; if(!$lens.is(':animated')){ if(nX>nBoundX&&nXnBoundY&&nY0) nRatioX=0; else if(nRatioX0) nRatioY=0; else if(nRatioY'); } $container=$image.parent('.magnify'); if($image.prev('.magnify-lens').length){ $container.children('.magnify-lens').css('background-image', 'url(\'' + sZoomSrc + '\')'); }else{ $image.before('
    '); } $lens=$container.children('.magnify-lens'); $lens.removeClass('loading'); nImageWidth=oOptions['finalWidth']||$image.width(); nImageHeight=oOptions['finalHeight']||$image.height(); nMagnifiedWidth=oOptions['magnifiedWidth']||elZoomImage.width; nMagnifiedHeight=oOptions['magnifiedHeight']||elZoomImage.height; nLensWidth=$lens.width(); nLensHeight=$lens.height(); oContainerOffset=getOffset(); if(oOptions['limitBounds']){ nBoundX=(nLensWidth/2) / (nMagnifiedWidth/nImageWidth); nBoundY=(nLensHeight/2) / (nMagnifiedHeight/nImageHeight); } if(nMagnifiedWidth!==elZoomImage.width||nMagnifiedHeight!==elZoomImage.height){ $lens.css('background-size', nMagnifiedWidth + 'px ' + nMagnifiedHeight + 'px'); } $image.data('zoomSize', { 'width': nMagnifiedWidth, 'height': nMagnifiedHeight }); $container.data('mobileCloseEvent', oDataAttr['mobileCloseEvent']||oOptions['mobileCloseEvent']); elZoomImage=null; oOptions.afterLoad(); if($lens.is(':visible')) moveLens(); $container.off().on({ 'mousemove touchmove': moveLens, 'mouseenter': function(){ oContainerOffset=getOffset(); }, 'mouseleave': hideLens }); if(oOptions['timeout']>=0){ $container.on('touchend', function(){ setTimeout(hideLens, oOptions['timeout']); }); } $('body').not($container).on('touchstart', hideLens); var sUsemap=$image.attr('usemap'); if(sUsemap){ var $map=$('map[name=' + sUsemap.slice(1) + ']'); $image.after($map); $container.click(function(e){ if(e.clientX||e.clientY){ $lens.hide(); var elPoint=document.elementFromPoint(e.clientX||e.originalEvent.touches[0].clientX, e.clientY||e.originalEvent.touches[0].clientY ); if(elPoint.nodeName==='AREA'){ elPoint.click(); }else{ $('area', $map).each(function(){ var a=$(this).attr('coords').split(','); if(nX>=a[0]&&nX<=a[2]&&nY>=a[1]&&nY<=a[3]){ this.click(); return false; }}); }} }); } if($anchor.length){ $anchor.css('display', 'inline-block'); if($anchor.attr('href')&&!(oDataAttr['src']||oOptions['src'])){ $anchor.click(function(e){ e.preventDefault(); }); }} }, 'error': function(){ elZoomImage=null; }}); elZoomImage.src=sZoomSrc; }, nTimer=0, refresh=function(){ clearTimeout(nTimer); nTimer=setTimeout(function(){ $that.destroy(); $that.magnify(oOptions); }, 100); }; this.destroy=function(){ this.each(function(){ var $this=$(this), $lens=$this.prev('div.magnify-lens'), sStyle=$this.data('originalStyle'); if($this.parent('div.magnify').length&&$lens.length){ if(sStyle) $this.attr('style', sStyle); else $this.removeAttr('style'); $this.unwrap(); $lens.remove(); }}); $(window).off('resize', refresh); return $that; } $(window).resize(refresh); return this.each(function(){ init(this); }); };}(jQuery)); (function($){ if(!$.fn.magnify) return; $('').appendTo('head'); $(window).on('load', function(){ $('body').append('
    '); var $lensMobile=$('.lens-mobile'); if($lensMobile.is(':visible')&&!!('ontouchstart' in window||(window.DocumentTouch&&document instanceof DocumentTouch)||navigator.msMaxTouchPoints)){ var $magnify=$('.magnify'), $magnifyMobile=$('.magnify-mobile'); $magnify.off(); $magnifyMobile.hide().append('×'); $magnifyMobile.children('.close').on($magnify.data('mobileCloseEvent'), function(){ $magnifyMobile.toggle(); }); $magnify.children('img').on({ 'touchend': function(){ if($(this).data('drag')) return; var oScrollOffset=$(this).data('scrollOffset'); $magnifyMobile.toggle(); $lensMobile.scrollLeft(oScrollOffset.x); $lensMobile.scrollTop(oScrollOffset.y); }, 'touchmove': function(){ $(this).data('drag', true); }, 'touchstart': function(e){ $lensMobile.html(''); var $magnifyImage=$(this), oZoomSize=$magnifyImage.data('zoomSize'), nX=e.originalEvent.touches[0].pageX - $magnifyImage.offset().left, nXPct=nX / $magnifyImage.width(), nY=e.originalEvent.touches[0].pageY - $magnifyImage.offset().top, nYPct=nY / $magnifyImage.height(); $magnifyImage.data('scrollOffset', { 'x': (oZoomSize.width*nXPct)-(window.innerWidth/2), 'y': (oZoomSize.height*nYPct)-(window.innerHeight/2) }); $(this).data('drag', false); }}); }}); }(jQuery)); !function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){"use strict";function b(a){if(a instanceof Date)return a;if(String(a).match(g))return String(a).match(/^[0-9]*$/)&&(a=Number(a)),String(a).match(/\-/)&&(a=String(a).replace(/\-/g,"/")),new Date(a);throw new Error("Couldn't cast `"+a+"` to a date object.")}function c(a){var b=a.toString().replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");return new RegExp(b)}function d(a){return function(b){var d=b.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi);if(d)for(var f=0,g=d.length;f1?c:d}var f=[],g=[],h={precision:100,elapse:!1,defer:!1};g.push(/^[0-9]*$/.source),g.push(/([0-9]{1,2}\/){2}[0-9]{4}([0-9]{1,2}(:[0-9]{2}){2})?/.source),g.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}([0-9]{1,2}(:[0-9]{2}){2})?/.source),g=new RegExp(g.join("|"));var i={Y:"years",m:"months",n:"daysToMonth",d:"daysToWeek",w:"weeks",W:"weeksToMonth",H:"hours",M:"minutes",S:"seconds",D:"totalDays",I:"totalHours",N:"totalMinutes",T:"totalSeconds"},j=function(b,c,d){this.el=b,this.$el=a(b),this.interval=null,this.offset={},this.options=a.extend({},h),this.firstTick=!0,this.instanceNumber=f.length,f.push(this),this.$el.data("countdown-instance",this.instanceNumber),d&&("function"==typeof d?(this.$el.on("update.countdown",d),this.$el.on("stoped.countdown",d),this.$el.on("finish.countdown",d)):this.options=a.extend({},h,d)),this.setFinalDate(c),this.options.defer===!1&&this.start()};a.extend(j.prototype,{start:function(){null!==this.interval&&clearInterval(this.interval);var a=this;this.update(),this.interval=setInterval(function(){a.update.call(a)},this.options.precision)},stop:function(){clearInterval(this.interval),this.interval=null,this.dispatchEvent("stoped")},toggle:function(){this.interval?this.stop():this.start()},pause:function(){this.stop()},resume:function(){this.start()},remove:function(){this.stop.call(this),f[this.instanceNumber]=null,delete this.$el.data().countdownInstance},setFinalDate:function(a){this.finalDate=b(a)},update:function(){if(0===this.$el.closest("html").length)return void this.remove();var a,b=new Date;return a=this.finalDate.getTime()-b.getTime(),a=Math.ceil(a/1e3),a=!this.options.elapse&&a<0?0:Math.abs(a),this.totalSecsLeft===a||this.firstTick?void(this.firstTick=!1):(this.totalSecsLeft=a,this.elapsed=b>=this.finalDate,this.offset={seconds:this.totalSecsLeft%60,minutes:Math.floor(this.totalSecsLeft/60)%60,hours:Math.floor(this.totalSecsLeft/60/60)%24,days:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToWeek:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToMonth:Math.floor(this.totalSecsLeft/60/60/24%30.4368),weeks:Math.floor(this.totalSecsLeft/60/60/24/7),weeksToMonth:Math.floor(this.totalSecsLeft/60/60/24/7)%4,months:Math.floor(this.totalSecsLeft/60/60/24/30.4368),years:Math.abs(this.finalDate.getFullYear()-b.getFullYear()),totalDays:Math.floor(this.totalSecsLeft/60/60/24),totalHours:Math.floor(this.totalSecsLeft/60/60),totalMinutes:Math.floor(this.totalSecsLeft/60),totalSeconds:this.totalSecsLeft},void(this.options.elapse||0!==this.totalSecsLeft?this.dispatchEvent("update"):(this.stop(),this.dispatchEvent("finish"))))},dispatchEvent:function(b){var c=a.Event(b+".countdown");c.finalDate=this.finalDate,c.elapsed=this.elapsed,c.offset=a.extend({},this.offset),c.strftime=d(this.offset),this.$el.trigger(c)}}),a.fn.countdown=function(){var b=Array.prototype.slice.call(arguments,0);return this.each(function(){var c=a(this).data("countdown-instance");if(void 0!==c){var d=f[c],e=b[0];j.prototype.hasOwnProperty(e)?d[e].apply(d,b.slice(1)):null===String(e).match(/^[$A-Z_][0-9A-Z_$]*$/i)?(d.setFinalDate.call(d,e),d.start()):a.error("Method %s does not exist on jQuery.countdown".replace(/\%s/gi,e))}else new j(this,b[0],b[1])})}}); !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)}(function(a){var e,t,n,i;function r(e,t){var n,i,r=e.nodeName.toLowerCase();return"area"===r?(i=(n=e.parentNode).name,!(!e.href||!i||"map"!==n.nodeName.toLowerCase())&&(!!(i=a("img[usemap='#"+i+"']")[0])&&o(i))):(/^(input|select|textarea|button|object)$/.test(r)?!e.disabled:"a"===r&&e.href||t)&&o(e)}function o(e){return a.expr.filters.visible(e)&&!a(e).parents().addBack().filter(function(){return"hidden"===a.css(this,"visibility")}).length}a.ui=a.ui||{},a.extend(a.ui,{version:"1.11.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),a.fn.extend({scrollParent:function(e){var t=this.css("position"),n="absolute"===t,i=e?/(auto|scroll|hidden)/:/(auto|scroll)/,e=this.parents().filter(function(){var e=a(this);return(!n||"static"!==e.css("position"))&&i.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==t&&e.length?e:a(this[0].ownerDocument||document)},uniqueId:(e=0,function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&a(this).removeAttr("id")})}}),a.extend(a.expr[":"],{data:a.expr.createPseudo?a.expr.createPseudo(function(t){return function(e){return!!a.data(e,t)}}):function(e,t,n){return!!a.data(e,n[3])},focusable:function(e){return r(e,!isNaN(a.attr(e,"tabindex")))},tabbable:function(e){var t=a.attr(e,"tabindex"),n=isNaN(t);return(n||0<=t)&&r(e,!n)}}),a("").outerWidth(1).jquery||a.each(["Width","Height"],function(e,n){var r="Width"===n?["Left","Right"]:["Top","Bottom"],i=n.toLowerCase(),o={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};function s(e,t,n,i){return a.each(r,function(){t-=parseFloat(a.css(e,"padding"+this))||0,n&&(t-=parseFloat(a.css(e,"border"+this+"Width"))||0),i&&(t-=parseFloat(a.css(e,"margin"+this))||0)}),t}a.fn["inner"+n]=function(e){return void 0===e?o["inner"+n].call(this):this.each(function(){a(this).css(i,s(this,e)+"px")})},a.fn["outer"+n]=function(e,t){return"number"!=typeof e?o["outer"+n].call(this,e):this.each(function(){a(this).css(i,s(this,e,!0,t)+"px")})}}),a.fn.addBack||(a.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),a("").data("a-b","a").removeData("a-b").data("a-b")&&(a.fn.removeData=(t=a.fn.removeData,function(e){return arguments.length?t.call(this,a.camelCase(e)):t.call(this)})),a.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),a.fn.extend({focus:(i=a.fn.focus,function(t,n){return"number"==typeof t?this.each(function(){var e=this;setTimeout(function(){a(e).focus(),n&&n.call(e)},t)}):i.apply(this,arguments)}),disableSelection:(n="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.bind(n+".ui-disableSelection",function(e){e.preventDefault()})}),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(e){if(void 0!==e)return this.css("zIndex",e);if(this.length)for(var t,n,i=a(this[0]);i.length&&i[0]!==document;){if(t=i.css("position"),("absolute"===t||"relative"===t||"fixed"===t)&&(n=parseInt(i.css("zIndex"),10),!isNaN(n)&&0!==n))return n;i=i.parent()}return 0}}),a.ui.plugin={add:function(e,t,n){var i,r=a.ui[e].prototype;for(i in n)r.plugins[i]=r.plugins[i]||[],r.plugins[i].push([t,n[i]])},call:function(e,t,n,i){var r,o=e.plugins[t];if(o&&(i||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(r=0;r",options:{disabled:!1,create:null},_createWidget:function(t,e){e=d(e||this.defaultElement||this)[0],this.element=d(e),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=d(),this.hoverable=d(),this.focusable=d(),e!==this&&(d.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=d(e.style?e.ownerDocument:e.document||e),this.window=d(this.document[0].defaultView||this.document[0].parentWindow)),this.options=d.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:d.noop,_getCreateEventData:d.noop,_create:d.noop,_init:d.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(d.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:d.noop,widget:function(){return this.element},option:function(t,e){var i,n,s,o=t;if(0===arguments.length)return d.widget.extend({},this.options);if("string"==typeof t)if(o={},t=(i=t.split(".")).shift(),i.length){for(n=o[t]=d.widget.extend({},this.options[t]),s=0;s=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})}); !function(t){"function"==typeof define&&define.amd?define(["jquery","./core","./mouse","./widget"],t):t(jQuery)}(function(u){return u.widget("ui.sortable",u.ui.mouse,{version:"1.11.4",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return e<=t&&t*{ cursor: "+r.cursor+" !important; }").appendTo(o)),r.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",r.opacity)),r.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",r.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!i)for(s=this.containers.length-1;0<=s;s--)this.containers[s]._trigger("activate",t,this._uiHash(this));return u.ui.ddmanager&&(u.ui.ddmanager.current=this),u.ui.ddmanager&&!r.dropBehaviour&&u.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var e,i,s,o,r=this.options,n=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageYt[this.floating?"width":"height"]?l&&c:r",i.document[0]).addClass(s||i.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tbody"===t?i._createTrPlaceholder(i.currentItem.find("tr").eq(0),u("",i.document[0]).appendTo(e)):"tr"===t?i._createTrPlaceholder(i.currentItem,e):"img"===t&&e.attr("src",i.currentItem.attr("src")),s||e.css("visibility","hidden"),e},update:function(t,e){s&&!o.forcePlaceholderSize||(e.height()||e.height(i.currentItem.innerHeight()-parseInt(i.currentItem.css("paddingTop")||0,10)-parseInt(i.currentItem.css("paddingBottom")||0,10)),e.width()||e.width(i.currentItem.innerWidth()-parseInt(i.currentItem.css("paddingLeft")||0,10)-parseInt(i.currentItem.css("paddingRight")||0,10)))}}),i.placeholder=u(o.placeholder.element.call(i.element,i.currentItem)),i.currentItem.after(i.placeholder),o.placeholder.update(i,i.placeholder)},_createTrPlaceholder:function(t,e){var i=this;t.children().each(function(){u(" ",i.document[0]).attr("colspan",u(this).attr("colspan")||1).appendTo(e)})},_contactContainers:function(t){for(var e,i,s,o,r,n,h,a,l,c=null,p=null,f=this.containers.length-1;0<=f;f--)u.contains(this.currentItem[0],this.containers[f].element[0])||(this._intersectsWith(this.containers[f].containerCache)?c&&u.contains(this.containers[f].element[0],c.element[0])||(c=this.containers[f],p=f):this.containers[f].containerCache.over&&(this.containers[f]._trigger("out",t,this._uiHash(this)),this.containers[f].containerCache.over=0));if(c)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(i=1e4,s=null,o=(a=c.floating||this._isFloating(this.currentItem))?"left":"top",r=a?"width":"height",l=a?"clientX":"clientY",e=this.items.length-1;0<=e;e--)u.contains(this.containers[p].element[0],this.items[e].item[0])&&this.items[e].item[0]!==this.currentItem[0]&&(n=this.items[e].item.offset()[o],h=!1,t[l]-n>this.items[e][r]/2&&(h=!0),Math.abs(t[l]-n)this.containment[2]&&(i=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(s=this.containment[3]+this.offset.click.top)),e.grid&&(t=this.originalPageY+Math.round((s-this.originalPageY)/e.grid[1])*e.grid[1],s=!this.containment||t-this.offset.click.top>=this.containment[1]&&t-this.offset.click.top<=this.containment[3]?t:t-this.offset.click.top>=this.containment[1]?t-e.grid[1]:t+e.grid[1],t=this.originalPageX+Math.round((i-this.originalPageX)/e.grid[0])*e.grid[0],i=!this.containment||t-this.offset.click.left>=this.containment[0]&&t-this.offset.click.left<=this.containment[2]?t:t-this.offset.click.left>=this.containment[0]?t-e.grid[0]:t+e.grid[0])),{top:s-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():r?0:o.scrollTop()),left:i-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():r?0:o.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var o=this.counter;this._delay(function(){o===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){this.reverting=!1;var i,s=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)"auto"!==this._storedCSS[i]&&"static"!==this._storedCSS[i]||(this._storedCSS[i]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();function o(e,i,s){return function(t){s._trigger(e,t,i._uiHash(i))}}for(this.fromOutside&&!e&&s.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||s.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(s.push(function(t){this._trigger("remove",t,this._uiHash())}),s.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),s.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;0<=i;i--)e||s.push(o("deactivate",this,this.containers[i])),this.containers[i].containerCache.over&&(s.push(o("out",this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(i=0;i"))}function a(e){var t="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.delegate(t,"mouseout",function(){M(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&M(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&M(this).removeClass("ui-datepicker-next-hover")}).delegate(t,"mouseover",r)}function r(){M.datepicker._isDisabledDatepicker((n.inline?n.dpDiv.parent():n.input)[0])||(M(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),M(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&M(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&M(this).addClass("ui-datepicker-next-hover"))}function c(e,t){for(var a in M.extend(e,t),t)null==t[a]&&(e[a]=t[a]);return e}return M.extend(M.ui,{datepicker:{version:"1.11.4"}}),M.extend(e.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return c(this._defaults,e||{}),this},_attachDatepicker:function(e,t){var a,i=e.nodeName.toLowerCase(),s="div"===i||"span"===i;e.id||(this.uuid+=1,e.id="dp"+this.uuid),(a=this._newInst(M(e),s)).settings=M.extend({},t||{}),"input"===i?this._connectDatepicker(e,a):s&&this._inlineDatepicker(e,a)},_newInst:function(e,t){return{id:e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1"),input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:t,dpDiv:t?a(M("
    ")):this.dpDiv}},_connectDatepicker:function(e,t){var a=M(e);t.append=M([]),t.trigger=M([]),a.hasClass(this.markerClassName)||(this._attachments(a,t),a.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(t),M.data(e,"datepicker",t),t.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,t){var a,i=this._get(t,"appendText"),s=this._get(t,"isRTL");t.append&&t.append.remove(),i&&(t.append=M(""+i+""),e[s?"before":"after"](t.append)),e.unbind("focus",this._showDatepicker),t.trigger&&t.trigger.remove(),"focus"!==(a=this._get(t,"showOn"))&&"both"!==a||e.focus(this._showDatepicker),"button"!==a&&"both"!==a||(i=this._get(t,"buttonText"),a=this._get(t,"buttonImage"),t.trigger=M(this._get(t,"buttonImageOnly")?M("").addClass(this._triggerClass).attr({src:a,alt:i,title:i}):M("").addClass(this._triggerClass).html(a?M("").attr({src:a,alt:i,title:i}):i)),e[s?"before":"after"](t.trigger),t.trigger.click(function(){return M.datepicker._datepickerShowing&&M.datepicker._lastInput===e[0]?M.datepicker._hideDatepicker():(M.datepicker._datepickerShowing&&M.datepicker._lastInput!==e[0]&&M.datepicker._hideDatepicker(),M.datepicker._showDatepicker(e[0])),!1}))},_autoSize:function(e){var t,a,i,s,n,r;this._get(e,"autoSize")&&!e.inline&&(n=new Date(2009,11,20),(r=this._get(e,"dateFormat")).match(/[DM]/)&&(n.setMonth((t=function(e){for(s=i=a=0;sa&&(a=e[s].length,i=s);return i})(this._get(e,r.match(/MM/)?"monthNames":"monthNamesShort"))),n.setDate(t(this._get(e,r.match(/DD/)?"dayNames":"dayNamesShort"))+20-n.getDay())),e.input.attr("size",this._formatDate(e,n).length))},_inlineDatepicker:function(e,t){var a=M(e);a.hasClass(this.markerClassName)||(a.addClass(this.markerClassName).append(t.dpDiv),M.data(e,"datepicker",t),this._setDate(t,this._getDefaultDate(t),!0),this._updateDatepicker(t),this._updateAlternate(t),t.settings.disabled&&this._disableDatepicker(e),t.dpDiv.css("display","block"))},_dialogDatepicker:function(e,t,a,i,s){var n,r=this._dialogInst;return r||(this.uuid+=1,n="dp"+this.uuid,this._dialogInput=M(""),this._dialogInput.keydown(this._doKeyDown),M("body").append(this._dialogInput),(r=this._dialogInst=this._newInst(this._dialogInput,!1)).settings={},M.data(this._dialogInput[0],"datepicker",r)),c(r.settings,i||{}),t=t&&t.constructor===Date?this._formatDate(r,t):t,this._dialogInput.val(t),this._pos=s?s.length?s:[s.pageX,s.pageY]:null,this._pos||(n=document.documentElement.clientWidth,i=document.documentElement.clientHeight,t=document.documentElement.scrollLeft||document.body.scrollLeft,s=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[n/2-100+t,i/2-150+s]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),r.settings.onSelect=a,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),M.blockUI&&M.blockUI(this.dpDiv),M.data(this._dialogInput[0],"datepicker",r),this},_destroyDatepicker:function(e){var t,a=M(e),i=M.data(e,"datepicker");a.hasClass(this.markerClassName)&&(t=e.nodeName.toLowerCase(),M.removeData(e,"datepicker"),"input"===t?(i.append.remove(),i.trigger.remove(),a.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):"div"!==t&&"span"!==t||a.removeClass(this.markerClassName).empty(),n===i&&(n=null))},_enableDatepicker:function(t){var e,a=M(t),i=M.data(t,"datepicker");a.hasClass(this.markerClassName)&&("input"===(e=t.nodeName.toLowerCase())?(t.disabled=!1,i.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):"div"!==e&&"span"!==e||((a=a.children("."+this._inlineClass)).children().removeClass("ui-state-disabled"),a.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=M.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var e,a=M(t),i=M.data(t,"datepicker");a.hasClass(this.markerClassName)&&("input"===(e=t.nodeName.toLowerCase())?(t.disabled=!0,i.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):"div"!==e&&"span"!==e||((a=a.children("."+this._inlineClass)).children().addClass("ui-state-disabled"),a.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=M.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;td&&ic&&st;)--B<0&&(B=11,J--);for(e.drawMonth=B,e.drawYear=J,E=this._get(e,"prevText"),E=L?this.formatDate(E,this._daylightSavingAdjust(new Date(J,B-A,1)),this._getFormatConfig(e)):E,a=this._canAdjustMonth(e,-1,J,B)?"
    "+E+"":R?"":""+E+"",E=this._get(e,"nextText"),E=L?this.formatDate(E,this._daylightSavingAdjust(new Date(J,B+A,1)),this._getFormatConfig(e)):E,i=this._canAdjustMonth(e,1,J,B)?""+E+"":R?"":""+E+"",R=this._get(e,"currentText"),E=this._get(e,"gotoCurrent")&&e.currentDay?P:K,R=L?this.formatDate(R,E,this._getFormatConfig(e)):R,L=e.inline?"":"",L=O?"
    "+(j?L:"")+(this._isInRange(e,E)?"":"")+(j?"":L)+"
    ":"",s=parseInt(this._get(e,"firstDay"),10),s=isNaN(s)?0:s,n=this._get(e,"showWeek"),r=this._get(e,"dayNames"),d=this._get(e,"dayNamesMin"),c=this._get(e,"monthNames"),o=this._get(e,"monthNamesShort"),l=this._get(e,"beforeShowDay"),h=this._get(e,"showOtherMonths"),u=this._get(e,"selectOtherMonths"),p=this._getDefaultDate(e),g="",f=0;f"+(/all|left/.test(y)&&0===f?j?i:a:"")+(/all|right/.test(y)&&0===f?j?a:i:"")+this._generateMonthYearHeader(e,B,J,U,z,0",M=n?"":"",_=0;_<7;_++)M+="";for(v+=M+"",C=this._getDaysInMonth(J,B),J===e.selectedYear&&B===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,C)),w=(this._getFirstDayOfMonth(J,B)-s+7)%7,C=Math.ceil((w+C)/7),I=H&&this.maxRows>C?this.maxRows:C,this.maxRows=I,x=this._daylightSavingAdjust(new Date(J,B,1-w)),Y=0;Y",S=n?"":"",_=0;_<7;_++)N=l?l.apply(e.input?e.input[0]:null,[x]):[!0,""],T=(F=x.getMonth()!==B)&&!u||!N[0]||U&&x"+(F&&!h?" ":T?""+x.getDate()+"":""+x.getDate()+"")+"",x.setDate(x.getDate()+1),x=this._daylightSavingAdjust(x);v+=S+""}11<++B&&(B=0,J++),k+=v+="
    "+this._get(e,"weekHeader")+""+d[b]+"
    "+this._get(e,"calculateWeek")(x)+"
    "+(H?""+(0":""):"")}g+=k}return g+=L,e._keyEvent=!1,g},_generateMonthYearHeader:function(e,t,a,i,s,n,r,d){var c,o,l,h,u,p,g,_=this._get(e,"changeMonth"),f=this._get(e,"changeYear"),k=this._get(e,"showMonthAfterYear"),D="
    ",m="";if(n||!_)m+=""+r[t]+"";else{for(c=i&&i.getFullYear()===a,o=s&&s.getFullYear()===a,m+=""}if(k||(D+=m+(!n&&_&&f?"":" ")),!e.yearshtml)if(e.yearshtml="",n||!f)D+=""+a+"";else{for(h=this._get(e,"yearRange").split(":"),u=(new Date).getFullYear(),p=(r=function(e){e=e.match(/c[+\-].*/)?a+parseInt(e.substring(1),10):e.match(/[+\-].*/)?u+parseInt(e,10):parseInt(e,10);return isNaN(e)?u:e})(h[0]),g=Math.max(p,r(h[1]||"")),p=i?Math.max(p,i.getFullYear()):p,g=s?Math.min(g,s.getFullYear()):g,e.yearshtml+="",D+=e.yearshtml,e.yearshtml=null}return D+=this._get(e,"yearSuffix"),k&&(D+=(!n&&_&&f?"":" ")+m),D+="
    "},_adjustInstDate:function(e,t,a){var i=e.drawYear+("Y"===a?t:0),s=e.drawMonth+("M"===a?t:0),t=Math.min(e.selectedDay,this._getDaysInMonth(i,s))+("D"===a?t:0),t=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(i,s,t)));e.selectedDay=t.getDate(),e.drawMonth=e.selectedMonth=t.getMonth(),e.drawYear=e.selectedYear=t.getFullYear(),"M"!==a&&"Y"!==a||this._notifyChange(e)},_restrictMinMax:function(e,t){var a=this._getMinMaxDate(e,"min"),e=this._getMinMaxDate(e,"max"),t=a&&t=a.getTime())&&(!i||t.getTime()<=i.getTime())&&(!s||t.getFullYear()>=s)&&(!n||t.getFullYear()<=n)},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return{shortYearCutoff:t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,a,i){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);t=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(i,a,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),t,this._getFormatConfig(e))}}),M.fn.datepicker=function(e){if(!this.length)return this;M.datepicker.initialized||(M(document).mousedown(M.datepicker._checkExternalClick),M.datepicker.initialized=!0),0===M("#"+M.datepicker._mainDivId).length&&M("body").append(M.datepicker.dpDiv);var t=Array.prototype.slice.call(arguments,1);return"string"==typeof e&&("isDisabled"===e||"getDate"===e||"widget"===e)||"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?M.datepicker["_"+e+"Datepicker"].apply(M.datepicker,[this[0]].concat(t)):this.each(function(){"string"==typeof e?M.datepicker["_"+e+"Datepicker"].apply(M.datepicker,[this].concat(t)):M.datepicker._attachDatepicker(this,e)})},M.datepicker=new e,M.datepicker.initialized=!1,M.datepicker.uuid=(new Date).getTime(),M.datepicker.version="1.11.4",M.datepicker}); +function ($){ "use strict"; var Tooltip=function (element, options){ this.type = this.options = this.enabled = this.timeout = this.hoverState = this.$element=null this.init('tooltip', element, options) } Tooltip.DEFAULTS={ animation: true , placement: 'top' , selector: false , template: '
    ' , trigger: 'hover focus' , title: '' , delay: 0 , html: false , container: false } Tooltip.prototype.init=function (type, element, options){ this.enabled=true this.type=type this.$element=$(element) this.options=this.getOptions(options) var triggers=this.options.trigger.split(' ') for (var i=triggers.length; i--;){ var trigger=triggers[i] if(trigger=='click'){ this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) }else if(trigger!='manual'){ var eventIn=trigger=='hover' ? 'mouseenter':'focus' var eventOut=trigger=='hover' ? 'mouseleave':'blur' this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) }} this.options.selector ? (this._options=$.extend({}, this.options, { trigger: 'manual', selector: '' })) : this.fixTitle() } Tooltip.prototype.getDefaults=function (){ return Tooltip.DEFAULTS } Tooltip.prototype.getOptions=function (options){ options=$.extend({}, this.getDefaults(), this.$element.data(), options) if(options.delay&&typeof options.delay=='number'){ options.delay={ show: options.delay , hide: options.delay }} return options } Tooltip.prototype.getDelegateOptions=function (){ var options={} var defaults=this.getDefaults() this._options&&$.each(this._options, function (key, value){ if(defaults[key]!=value) options[key]=value }) return options } Tooltip.prototype.enter=function (obj){ var self=obj instanceof this.constructor ? obj:$(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) clearTimeout(self.timeout) self.hoverState='in' if(!self.options.delay||!self.options.delay.show) return self.show() self.timeout=setTimeout(function (){ if(self.hoverState=='in') self.show() }, self.options.delay.show) } Tooltip.prototype.leave=function (obj){ var self=obj instanceof this.constructor ? obj:$(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) clearTimeout(self.timeout) self.hoverState='out' if(!self.options.delay||!self.options.delay.hide) return self.hide() self.timeout=setTimeout(function (){ if(self.hoverState=='out') self.hide() }, self.options.delay.hide) } Tooltip.prototype.show=function (){ var e=$.Event('show.bs.'+ this.type) if(this.hasContent()&&this.enabled){ this.$element.trigger(e) if(e.isDefaultPrevented()) return var $tip=this.tip() this.setContent() if(this.options.animation) $tip.addClass('fade') var placement=typeof this.options.placement=='function' ? this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement var autoToken=/\s?auto?\s?/i var autoPlace=autoToken.test(placement) if(autoPlace) placement=placement.replace(autoToken, '')||'top' $tip .detach() .css({ top: 0, left: 0, display: 'block' }) .addClass(placement) this.options.container ? $tip.appendTo(this.options.container):$tip.insertAfter(this.$element) var pos=this.getPosition() var actualWidth=$tip[0].offsetWidth var actualHeight=$tip[0].offsetHeight if(autoPlace){ var $parent=this.$element.parent() var orgPlacement=placement var docScroll=document.documentElement.scrollTop||document.body.scrollTop var parentWidth=this.options.container=='body' ? window.innerWidth:$parent.outerWidth() var parentHeight=this.options.container=='body' ? window.innerHeight:$parent.outerHeight() var parentLeft=this.options.container=='body' ? 0:$parent.offset().left placement=placement=='bottom'&&pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' : placement=='top'&&pos.top - docScroll - actualHeight < 0 ? 'bottom' : placement=='right'&&pos.right + actualWidth > parentWidth ? 'left' : placement=='left'&&pos.left - actualWidth < parentLeft ? 'right' : placement $tip .removeClass(orgPlacement) .addClass(placement) } var calculatedOffset=this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) this.applyPlacement(calculatedOffset, placement) this.$element.trigger('shown.bs.' + this.type) }} Tooltip.prototype.applyPlacement=function(offset, placement){ var replace var $tip=this.tip() var width=$tip[0].offsetWidth var height=$tip[0].offsetHeight var marginTop=parseInt($tip.css('margin-top'), 10) var marginLeft=parseInt($tip.css('margin-left'), 10) if(isNaN(marginTop)) marginTop=0 if(isNaN(marginLeft)) marginLeft=0 offset.top=offset.top + marginTop offset.left=offset.left + marginLeft $tip .offset(offset) .addClass('in') var actualWidth=$tip[0].offsetWidth var actualHeight=$tip[0].offsetHeight if(placement=='top'&&actualHeight!=height){ replace=true offset.top=offset.top + height - actualHeight } if(/bottom|top/.test(placement)){ var delta=0 if(offset.left < 0){ delta=offset.left * -2 offset.left=0 $tip.offset(offset) actualWidth=$tip[0].offsetWidth actualHeight=$tip[0].offsetHeight } this.replaceArrow(delta - width + actualWidth, actualWidth, 'left') }else{ this.replaceArrow(actualHeight - height, actualHeight, 'top') } if(replace) $tip.offset(offset) } Tooltip.prototype.replaceArrow=function(delta, dimension, position){ this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%"):'') } Tooltip.prototype.setContent=function (){ var $tip=this.tip() var title=this.getTitle() $tip.find('.tooltip-inner')[this.options.html ? 'html':'text'](title) $tip.removeClass('fade in top bottom left right') } Tooltip.prototype.hide=function (){ var that=this var $tip=this.tip() var e=$.Event('hide.bs.' + this.type) function complete(){ if(that.hoverState!='in') $tip.detach() } this.$element.trigger(e) if(e.isDefaultPrevented()) return $tip.removeClass('in') $.support.transition&&this.$tip.hasClass('fade') ? $tip .one($.support.transition.end, complete) .emulateTransitionEnd(150) : complete() this.$element.trigger('hidden.bs.' + this.type) return this } Tooltip.prototype.fixTitle=function (){ var $e=this.$element if($e.attr('title')||typeof($e.attr('data-original-title'))!='string'){ $e.attr('data-original-title', $e.attr('title')||'').attr('title', '') }} Tooltip.prototype.hasContent=function (){ return this.getTitle() } Tooltip.prototype.getPosition=function (){ var el=this.$element[0] return $.extend({}, (typeof el.getBoundingClientRect=='function') ? el.getBoundingClientRect():{ width: el.offsetWidth , height: el.offsetHeight }, this.$element.offset()) } Tooltip.prototype.getCalculatedOffset=function (placement, pos, actualWidth, actualHeight){ return placement=='bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : placement=='top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : placement=='left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }} Tooltip.prototype.getTitle=function (){ var title var $e=this.$element var o=this.options title=$e.attr('data-original-title') || (typeof o.title=='function' ? o.title.call($e[0]):o.title) return title } Tooltip.prototype.tip=function (){ return this.$tip=this.$tip||$(this.options.template) } Tooltip.prototype.arrow=function (){ return this.$arrow=this.$arrow||this.tip().find('.tooltip-arrow') } Tooltip.prototype.validate=function (){ if(!this.$element[0].parentNode){ this.hide() this.$element=null this.options=null }} Tooltip.prototype.enable=function (){ this.enabled=true } Tooltip.prototype.disable=function (){ this.enabled=false } Tooltip.prototype.toggleEnabled=function (){ this.enabled = !this.enabled } Tooltip.prototype.toggle=function (e){ var self=e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type):this self.tip().hasClass('in') ? self.leave(self):self.enter(self) } Tooltip.prototype.destroy=function (){ this.hide().$element.off('.' + this.type).removeData('bs.' + this.type) } var old=$.fn.tooltip $.fn.tooltip=function (option){ return this.each(function (){ var $this=$(this) var data=$this.data('bs.tooltip') var options=typeof option=='object'&&option if(!data) $this.data('bs.tooltip', (data=new Tooltip(this, options))) if(typeof option=='string') data[option]() }) } $.fn.tooltip.Constructor=Tooltip $.fn.tooltip.noConflict=function (){ $.fn.tooltip=old return this } $.fn.emulateTransitionEnd=function (duration){ var called=false, $el=this $(this).one($.support.transition.end, function (){ called=true }) var callback=function (){ if(!called) $($el).trigger($.support.transition.end) } setTimeout(callback, duration) return this }}(window.jQuery); +function ($){ "use strict"; var dismiss='[data-dismiss="alert"]' var Alert=function (el){ $(el).on('click', dismiss, this.close) } Alert.prototype.close=function (e){ var $this=$(this) var selector=$this.attr('data-target') if(!selector){ selector=$this.attr('href') selector=selector&&selector.replace(/.*(?=#[^\s]*$)/, '') } var $parent=$(selector) if(e) e.preventDefault() if(!$parent.length){ $parent=$this.hasClass('dokan-alert') ? $this:$this.parent() } $parent.trigger(e=$.Event('dokan-close.bs.alert')) if(e.isDefaultPrevented()) return $parent.removeClass('in') function removeElement(){ $parent.trigger('dokan-closed.bs.alert').remove() } $.support.transition&&$parent.hasClass('fade') ? $parent .one($.support.transition.end, removeElement) .emulateTransitionEnd(150) : removeElement() } var old=$.fn.alert $.fn.alert=function (option){ return this.each(function (){ var $this=$(this) var data=$this.data('bs.alert') if(!data) $this.data('bs.alert', (data=new Alert(this))) if(typeof option=='string') data[option].call($this) }) } $.fn.alert.Constructor=Alert $.fn.alert.noConflict=function (){ $.fn.alert=old return this } $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) }(window.jQuery); (function($){ $.extend($.fn, { validate: function(options){ if(!this.length){ if(options&&options.debug&&window.console){ console.warn("Nothing selected, can't validate, returning nothing."); } return; } var validator=$.data(this[0], "validator"); if(validator){ return validator; } this.attr("novalidate", "novalidate"); validator=new $.validator(options, this[0]); $.data(this[0], "validator", validator); if(validator.settings.onsubmit){ this.validateDelegate(":submit", "click", function(event){ if(validator.settings.submitHandler){ validator.submitButton=event.target; } if($(event.target).hasClass("cancel")){ validator.cancelSubmit=true; }}); this.submit(function(event){ if(validator.settings.debug){ event.preventDefault(); } function handle(){ var hidden; if(validator.settings.submitHandler){ if(validator.submitButton){ hidden=$("").attr("name", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm); } validator.settings.submitHandler.call(validator, validator.currentForm, event); if(validator.submitButton){ hidden.remove(); } return false; } return true; } if(validator.cancelSubmit){ validator.cancelSubmit=false; return handle(); } if(validator.form()){ if(validator.pendingRequest){ validator.formSubmitted=true; return false; } return handle(); }else{ validator.focusInvalid(); return false; }}); } return validator; }, valid: function(){ if($(this[0]).is("form")){ return this.validate().form(); }else{ var valid=true; var validator=$(this[0].form).validate(); this.each(function(){ valid &=validator.element(this); }); return valid; }}, removeAttrs: function(attributes){ var result={}, $element=this; $.each(attributes.split(/\s/), function(index, value){ result[value]=$element.attr(value); $element.removeAttr(value); }); return result; }, rules: function(command, argument){ var element=this[0]; if(command){ var settings=$.data(element.form, "validator").settings; var staticRules=settings.rules; var existingRules=$.validator.staticRules(element); switch(command){ case "add": $.extend(existingRules, $.validator.normalizeRule(argument)); staticRules[element.name]=existingRules; if(argument.messages){ settings.messages[element.name]=$.extend(settings.messages[element.name], argument.messages); } break; case "remove": if(!argument){ delete staticRules[element.name]; return existingRules; } var filtered={}; $.each(argument.split(/\s/), function(index, method){ filtered[method]=existingRules[method]; delete existingRules[method]; }); return filtered; }} var data=$.validator.normalizeRules($.extend({}, $.validator.classRules(element), $.validator.attributeRules(element), $.validator.dataRules(element), $.validator.staticRules(element) ), element); if(data.required){ var param=data.required; delete data.required; data=$.extend({required: param}, data); } return data; }}); $.extend($.expr[":"], { blank: function(a){ return !$.trim("" + a.value); }, filled: function(a){ return !!$.trim("" + a.value); }, unchecked: function(a){ return !a.checked; }}); $.validator=function(options, form){ this.settings=$.extend(true, {}, $.validator.defaults, options); this.currentForm=form; this.init(); }; $.validator.format=function(source, params){ if(arguments.length===1){ return function(){ var args=$.makeArray(arguments); args.unshift(source); return $.validator.format.apply(this, args); };} if(arguments.length > 2&¶ms.constructor!==Array){ params=$.makeArray(arguments).slice(1); } if(params.constructor!==Array){ params=[ params ]; } $.each(params, function(i, n){ source=source.replace(new RegExp("\\{" + i + "\\}", "g"), function(){ return n; }); }); return source; }; $.extend($.validator, { defaults: { messages: {}, groups: {}, rules: {}, errorClass: "error", validClass: "valid", errorElement: "label", focusInvalid: true, errorContainer: $([]), errorLabelContainer: $([]), onsubmit: true, ignore: ":hidden", ignoreTitle: false, onfocusin: function(element, event){ this.lastActive=element; if(this.settings.focusCleanup&&!this.blockFocusCleanup){ if(this.settings.unhighlight){ this.settings.unhighlight.call(this, element, this.settings.errorClass, this.settings.validClass); } this.addWrapper(this.errorsFor(element)).hide(); }}, onfocusout: function(element, event){ if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){ this.element(element); }}, /* onkeyup: function(element, event){ if(event.which===9&&this.elementValue(element)===""){ return; }else if(element.name in this.submitted||element===this.lastElement){ this.element(element); }}, */ onclick: function(element, event){ if(element.name in this.submitted){ this.element(element); } else if(element.parentNode.name in this.submitted){ this.element(element.parentNode); }}, highlight: function(element, errorClass, validClass){ if(element.type==="radio"){ this.findByName(element.name).addClass(errorClass).removeClass(validClass); }else{ $(element).addClass(errorClass).removeClass(validClass); }}, unhighlight: function(element, errorClass, validClass){ if(element.type==="radio"){ this.findByName(element.name).removeClass(errorClass).addClass(validClass); }else{ $(element).removeClass(errorClass).addClass(validClass); }} }, setDefaults: function(settings){ $.extend($.validator.defaults, settings); }, messages: { required: "This field is required.", remote: "Please fix this field.", email: "Please enter a valid email address.", url: "Please enter a valid URL.", date: "Please enter a valid date.", dateISO: "Please enter a valid date (ISO).", number: "Please enter a valid number.", digits: "Please enter only digits.", creditcard: "Please enter a valid credit card number.", equalTo: "Please enter the same value again.", maxlength: $.validator.format("Please enter no more than {0} characters."), minlength: $.validator.format("Please enter at least {0} characters."), rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."), range: $.validator.format("Please enter a value between {0} and {1}."), max: $.validator.format("Please enter a value less than or equal to {0}."), min: $.validator.format("Please enter a value greater than or equal to {0}.") }, autoCreateRanges: false, prototype: { init: function(){ this.labelContainer=$(this.settings.errorLabelContainer); this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm); this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer); this.submitted={}; this.valueCache={}; this.pendingRequest=0; this.pending={}; this.invalid={}; this.reset(); var groups=(this.groups={}); $.each(this.settings.groups, function(key, value){ if(typeof value==="string"){ value=value.split(/\s/); } $.each(value, function(index, name){ groups[name]=key; }); }); var rules=this.settings.rules; $.each(rules, function(key, value){ rules[key]=$.validator.normalizeRule(value); }); function delegate(event){ var validator=$.data(this[0].form, "validator"), eventType="on" + event.type.replace(/^validate/, ""); if(validator.settings[eventType]){ validator.settings[eventType].call(validator, this[0], event); }} $(this.currentForm) .validateDelegate(":text, [type='password'], [type='file'], select, textarea, " + "[type='number'], [type='search'] ,[type='tel'], [type='url'], " + "[type='email'], [type='datetime'], [type='date'], [type='month'], " + "[type='week'], [type='time'], [type='datetime-local'], " + "[type='range'], [type='color'] ", "focusin focusout keyup", delegate) .validateDelegate("[type='radio'], [type='checkbox'], select, option", "click", delegate); if(this.settings.invalidHandler){ $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler); }}, form: function(){ this.checkForm(); $.extend(this.submitted, this.errorMap); this.invalid=$.extend({}, this.errorMap); if(!this.valid()){ $(this.currentForm).triggerHandler("invalid-form", [this]); } this.showErrors(); return this.valid(); }, checkForm: function(){ this.prepareForm(); for(var i=0, elements=(this.currentElements=this.elements()); elements[i]; i++){ this.check(elements[i]); } return this.valid(); }, element: function(element){ element=this.validationTargetFor(this.clean(element)); this.lastElement=element; this.prepareElement(element); this.currentElements=$(element); var result=this.check(element)!==false; if(result){ delete this.invalid[element.name]; }else{ this.invalid[element.name]=true; } if(!this.numberOfInvalids()){ this.toHide=this.toHide.add(this.containers); } this.showErrors(); return result; }, showErrors: function(errors){ if(errors){ $.extend(this.errorMap, errors); this.errorList=[]; for(var name in errors){ this.errorList.push({ message: errors[name], element: this.findByName(name)[0] }); } this.successList=$.grep(this.successList, function(element){ return !(element.name in errors); }); } if(this.settings.showErrors){ this.settings.showErrors.call(this, this.errorMap, this.errorList); }else{ this.defaultShowErrors(); }}, resetForm: function(){ if($.fn.resetForm){ $(this.currentForm).resetForm(); } this.submitted={}; this.lastElement=null; this.prepareForm(); this.hideErrors(); this.elements().removeClass(this.settings.errorClass).removeData("previousValue"); }, numberOfInvalids: function(){ return this.objectLength(this.invalid); }, objectLength: function(obj){ var count=0; for(var i in obj){ count++; } return count; }, hideErrors: function(){ this.addWrapper(this.toHide).hide(); }, valid: function(){ return this.size()===0; }, size: function(){ return this.errorList.length; }, focusInvalid: function(){ if(this.settings.focusInvalid){ try { $(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]) .filter(":visible") .focus() .trigger("focusin"); } catch(e){ }} }, findLastActive: function(){ var lastActive=this.lastActive; return lastActive&&$.grep(this.errorList, function(n){ return n.element.name===lastActive.name; }).length===1&&lastActive; }, elements: function(){ var validator=this, rulesCache={}; return $(this.currentForm) .find("input, select, textarea") .not(":submit, :reset, :image, [disabled]") .not(this.settings.ignore) .filter(function(){ if(!this.name){ if(window.console){ console.error("%o has no name assigned", this); } throw new Error("Failed to validate, found an element with no name assigned. See console for element reference."); } if(this.name in rulesCache||!validator.objectLength($(this).rules())){ return false; } rulesCache[this.name]=true; return true; }); }, clean: function(selector){ return $(selector)[0]; }, errors: function(){ var errorClass=this.settings.errorClass.replace(" ", "."); return $(this.settings.errorElement + "." + errorClass, this.errorContext); }, reset: function(){ this.successList=[]; this.errorList=[]; this.errorMap={}; this.toShow=$([]); this.toHide=$([]); this.currentElements=$([]); }, prepareForm: function(){ this.reset(); this.toHide=this.errors().add(this.containers); }, prepareElement: function(element){ this.reset(); this.toHide=this.errorsFor(element); }, elementValue: function(element){ var type=$(element).attr("type"), val=$(element).val(); if(type==="radio"||type==="checkbox"){ return $("input[name='" + $(element).attr("name") + "']:checked").val(); } if(typeof val==="string"){ return val.replace(/\r/g, ""); } return val; }, check: function(element){ element=this.validationTargetFor(this.clean(element)); var rules=$(element).rules(); var dependencyMismatch=false; var val=this.elementValue(element); var result; for (var method in rules){ var rule={ method: method, parameters: rules[method] }; try { result=$.validator.methods[method].call(this, val, element, rule.parameters); if(result==="dependency-mismatch"){ dependencyMismatch=true; continue; } dependencyMismatch=false; if(result==="pending"){ this.toHide=this.toHide.not(this.errorsFor(element)); return; } if(!result){ this.formatAndAdd(element, rule); return false; }} catch(e){ if(this.settings.debug&&window.console){ console.log("Exception occured when checking element " + element.id + ", check the '" + rule.method + "' method.", e); } throw e; }} if(dependencyMismatch){ return; } if(this.objectLength(rules)){ this.successList.push(element); } return true; }, customDataMessage: function(element, method){ return $(element).data("msg-" + method.toLowerCase())||(element.attributes&&$(element).attr("data-msg-" + method.toLowerCase())); }, customMessage: function(name, method){ var m=this.settings.messages[name]; return m&&(m.constructor===String ? m:m[method]); }, findDefined: function(){ for(var i=0; i < arguments.length; i++){ if(arguments[i]!==undefined){ return arguments[i]; }} return undefined; }, defaultMessage: function(element, method){ return this.findDefined(this.customMessage(element.name, method), this.customDataMessage(element, method), !this.settings.ignoreTitle&&element.title||undefined, $.validator.messages[method], "Warning: No message defined for " + element.name + "" ); }, formatAndAdd: function(element, rule){ var message=this.defaultMessage(element, rule.method), theregex=/\$?\{(\d+)\}/g; if(typeof message==="function"){ message=message.call(this, rule.parameters, element); }else if(theregex.test(message)){ message=$.validator.format(message.replace(theregex, "{$1}"), rule.parameters); } this.errorList.push({ message: message, element: element }); this.errorMap[element.name]=message; this.submitted[element.name]=message; }, addWrapper: function(toToggle){ if(this.settings.wrapper){ toToggle=toToggle.add(toToggle.parent(this.settings.wrapper)); } return toToggle; }, defaultShowErrors: function(){ var i, elements; for(i=0; this.errorList[i]; i++){ var error=this.errorList[i]; if(this.settings.highlight){ this.settings.highlight.call(this, error.element, this.settings.errorClass, this.settings.validClass); } this.showLabel(error.element, error.message); } if(this.errorList.length){ this.toShow=this.toShow.add(this.containers); } if(this.settings.success){ for(i=0; this.successList[i]; i++){ this.showLabel(this.successList[i]); }} if(this.settings.unhighlight){ for(i=0, elements=this.validElements(); elements[i]; i++){ this.settings.unhighlight.call(this, elements[i], this.settings.errorClass, this.settings.validClass); }} this.toHide=this.toHide.not(this.toShow); this.hideErrors(); this.addWrapper(this.toShow).show(); }, validElements: function(){ return this.currentElements.not(this.invalidElements()); }, invalidElements: function(){ return $(this.errorList).map(function(){ return this.element; }); }, showLabel: function(element, message){ var label=this.errorsFor(element); if(label.length){ label.removeClass(this.settings.validClass).addClass(this.settings.errorClass); if(label.attr("generated")){ label.html(message); }}else{ label=$("<" + this.settings.errorElement + "/>") .attr({"for": this.idOrName(element), generated: true}) .addClass(this.settings.errorClass) .html(message||""); if(this.settings.wrapper){ label=label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent(); } if(!this.labelContainer.append(label).length){ if(this.settings.errorPlacement){ this.settings.errorPlacement(label, $(element)); }else{ label.insertAfter(element); }} } if(!message&&this.settings.success){ label.text(""); if(typeof this.settings.success==="string"){ label.addClass(this.settings.success); }else{ this.settings.success(label, element); }} this.toShow=this.toShow.add(label); }, errorsFor: function(element){ var name=this.idOrName(element); return this.errors().filter(function(){ return $(this).attr("for")===name; }); }, idOrName: function(element){ return this.groups[element.name]||(this.checkable(element) ? element.name:element.id||element.name); }, validationTargetFor: function(element){ if(this.checkable(element)){ element=this.findByName(element.name).not(this.settings.ignore)[0]; } return element; }, checkable: function(element){ return (/radio|checkbox/i).test(element.type); }, findByName: function(name){ return $(this.currentForm).find("[name='" + name + "']"); }, getLength: function(value, element){ switch(element.nodeName.toLowerCase()){ case "select": return $("option:selected", element).length; case "input": if(this.checkable(element)){ return this.findByName(element.name).filter(":checked").length; }} return value.length; }, depend: function(param, element){ return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element):true; }, dependTypes: { "boolean": function(param, element){ return param; }, "string": function(param, element){ return !!$(param, element.form).length; }, "function": function(param, element){ return param(element); }}, optional: function(element){ var val=this.elementValue(element); return !$.validator.methods.required.call(this, val, element)&&"dependency-mismatch"; }, startRequest: function(element){ if(!this.pending[element.name]){ this.pendingRequest++; this.pending[element.name]=true; }}, stopRequest: function(element, valid){ this.pendingRequest--; if(this.pendingRequest < 0){ this.pendingRequest=0; } delete this.pending[element.name]; if(valid&&this.pendingRequest===0&&this.formSubmitted&&this.form()){ $(this.currentForm).submit(); this.formSubmitted=false; }else if(!valid&&this.pendingRequest===0&&this.formSubmitted){ $(this.currentForm).triggerHandler("invalid-form", [this]); this.formSubmitted=false; }}, previousValue: function(element){ return $.data(element, "previousValue")||$.data(element, "previousValue", { old: null, valid: true, message: this.defaultMessage(element, "remote") }); }}, classRuleSettings: { required: {required: true}, email: {email: true}, url: {url: true}, date: {date: true}, dateISO: {dateISO: true}, number: {number: true}, digits: {digits: true}, creditcard: {creditcard: true}}, addClassRules: function(className, rules){ if(className.constructor===String){ this.classRuleSettings[className]=rules; }else{ $.extend(this.classRuleSettings, className); }}, classRules: function(element){ var rules={}; var classes=$(element).attr("class"); if(classes){ $.each(classes.split(" "), function(){ if(this in $.validator.classRuleSettings){ $.extend(rules, $.validator.classRuleSettings[this]); }}); } return rules; }, attributeRules: function(element){ var rules={}; var $element=$(element); for (var method in $.validator.methods){ var value; if(method==="required"){ value=$element.get(0).getAttribute(method); if(value===""){ value=true; } value = !!value; }else{ value=$element.attr(method); } if(value){ rules[method]=value; }else if($element[0].getAttribute("type")===method){ rules[method]=true; }} if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){ delete rules.maxlength; } return rules; }, dataRules: function(element){ var method, value, rules={}, $element=$(element); for (method in $.validator.methods){ value=$element.data("rule-" + method.toLowerCase()); if(value!==undefined){ rules[method]=value; }} return rules; }, staticRules: function(element){ var rules={}; var validator=$.data(element.form, "validator"); if(validator.settings.rules){ rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};} return rules; }, normalizeRules: function(rules, element){ $.each(rules, function(prop, val){ if(val===false){ delete rules[prop]; return; } if(val.param||val.depends){ var keepRule=true; switch (typeof val.depends){ case "string": keepRule = !!$(val.depends, element.form).length; break; case "function": keepRule=val.depends.call(element, element); break; } if(keepRule){ rules[prop]=val.param!==undefined ? val.param:true; }else{ delete rules[prop]; }} }); $.each(rules, function(rule, parameter){ rules[rule]=$.isFunction(parameter) ? parameter(element):parameter; }); $.each(["minlength", "maxlength", "min", "max"], function(){ if(rules[this]){ rules[this]=Number(rules[this]); }}); $.each(["rangelength", "range"], function(){ var parts; if(rules[this]){ if($.isArray(rules[this])){ rules[this]=[Number(rules[this][0]), Number(rules[this][1])]; }else if(typeof rules[this]==="string"){ parts=rules[this].split(/[\s,]+/); rules[this]=[Number(parts[0]), Number(parts[1])]; }} }); if($.validator.autoCreateRanges){ if(rules.min&&rules.max){ rules.range=[rules.min, rules.max]; delete rules.min; delete rules.max; } if(rules.minlength&&rules.maxlength){ rules.rangelength=[rules.minlength, rules.maxlength]; delete rules.minlength; delete rules.maxlength; }} return rules; }, normalizeRule: function(data){ if(typeof data==="string"){ var transformed={}; $.each(data.split(/\s/), function(){ transformed[this]=true; }); data=transformed; } return data; }, addMethod: function(name, method, message){ $.validator.methods[name]=method; $.validator.messages[name]=message!==undefined ? message:$.validator.messages[name]; if(method.length < 3){ $.validator.addClassRules(name, $.validator.normalizeRule(name)); }}, methods: { required: function(value, element, param){ if(!this.depend(param, element)){ return "dependency-mismatch"; } if(element.nodeName.toLowerCase()==="select"){ var val=$(element).val(); return val&&val.length > 0; } if(this.checkable(element)){ return this.getLength(value, element) > 0; } return $.trim(value).length > 0; }, remote: function(value, element, param){ if(this.optional(element)){ return "dependency-mismatch"; } var previous=this.previousValue(element); if(!this.settings.messages[element.name]){ this.settings.messages[element.name]={};} previous.originalMessage=this.settings.messages[element.name].remote; this.settings.messages[element.name].remote=previous.message; param=typeof param==="string"&&{url:param}||param; if(previous.old===value){ return previous.valid; } previous.old=value; var validator=this; this.startRequest(element); var data={}; data[element.name]=value; $.ajax($.extend(true, { url: param, mode: "abort", port: "validate" + element.name, dataType: "json", data: data, success: function(response){ validator.settings.messages[element.name].remote=previous.originalMessage; var valid=response===true||response==="true"; if(valid){ var submitted=validator.formSubmitted; validator.prepareElement(element); validator.formSubmitted=submitted; validator.successList.push(element); delete validator.invalid[element.name]; validator.showErrors(); }else{ var errors={}; var message=response||validator.defaultMessage(element, "remote"); errors[element.name]=previous.message=$.isFunction(message) ? message(value):message; validator.invalid[element.name]=true; validator.showErrors(errors); } previous.valid=valid; validator.stopRequest(element, valid); }}, param)); return "pending"; }, minlength: function(value, element, param){ var length=$.isArray(value) ? value.length:this.getLength($.trim(value), element); return this.optional(element)||length >=param; }, maxlength: function(value, element, param){ var length=$.isArray(value) ? value.length:this.getLength($.trim(value), element); return this.optional(element)||length <=param; }, rangelength: function(value, element, param){ var length=$.isArray(value) ? value.length:this.getLength($.trim(value), element); return this.optional(element)||(length >=param[0]&&length <=param[1]); }, min: function(value, element, param){ return this.optional(element)||value >=param; }, max: function(value, element, param){ return this.optional(element)||value <=param; }, range: function(value, element, param){ return this.optional(element)||(value >=param[0]&&value <=param[1]); }, email: function(value, element){ return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(value); }, url: function(value, element){ return this.optional(element)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); }, date: function(value, element){ return this.optional(element)||!/Invalid|NaN/.test(new Date(value).toString()); }, dateISO: function(value, element){ return this.optional(element)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(value); }, number: function(value, element){ return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value); }, digits: function(value, element){ return this.optional(element)||/^\d+$/.test(value); }, creditcard: function(value, element){ if(this.optional(element)){ return "dependency-mismatch"; } if(/[^0-9 \-]+/.test(value)){ return false; } var nCheck=0, nDigit=0, bEven=false; value=value.replace(/\D/g, ""); for (var n=value.length - 1; n >=0; n--){ var cDigit=value.charAt(n); nDigit=parseInt(cDigit, 10); if(bEven){ if((nDigit *=2) > 9){ nDigit -=9; }} nCheck +=nDigit; bEven = !bEven; } return (nCheck % 10)===0; }, equalTo: function(value, element, param){ var target=$(param); if(this.settings.onfocusout){ target.unbind(".validate-equalTo").bind("blur.validate-equalTo", function(){ $(element).valid(); }); } return value===target.val(); }} }); $.format=$.validator.format; }(jQuery)); (function($){ var pendingRequests={}; if($.ajaxPrefilter){ $.ajaxPrefilter(function(settings, _, xhr){ var port=settings.port; if(settings.mode==="abort"){ if(pendingRequests[port]){ pendingRequests[port].abort(); } pendingRequests[port]=xhr; }}); }else{ var ajax=$.ajax; $.ajax=function(settings){ var mode=("mode" in settings ? settings:$.ajaxSettings).mode, port=("port" in settings ? settings:$.ajaxSettings).port; if(mode==="abort"){ if(pendingRequests[port]){ pendingRequests[port].abort(); } return (pendingRequests[port]=ajax.apply(this, arguments)); } return ajax.apply(this, arguments); };}}(jQuery)); (function($){ $.extend($.fn, { validateDelegate: function(delegate, type, handler){ return this.bind(type, function(event){ var target=$(event.target); if(target.is(delegate)){ return handler.apply(target, arguments); }}); }}); }(jQuery)); !function(a){"use strict";var e={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"Ae","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"Oe","Ő":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"Ue","Ű":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"ae","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"oe","ő":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"ue","ű":"u","ý":"y","þ":"th","ÿ":"y","ẞ":"SS","ا":"a","أ":"a","إ":"i","آ":"aa","ؤ":"u","ئ":"e","ء":"a","ب":"b","ت":"t","ث":"th","ج":"j","ح":"h","خ":"kh","د":"d","ذ":"th","ر":"r","ز":"z","س":"s","ش":"sh","ص":"s","ض":"dh","ط":"t","ظ":"z","ع":"a","غ":"gh","ف":"f","ق":"q","ك":"k","ل":"l","م":"m","ن":"n","ه":"h","و":"w","ي":"y","ى":"a","ة":"h","ﻻ":"la","ﻷ":"laa","ﻹ":"lai","ﻵ":"laa","گ":"g","چ":"ch","پ":"p","ژ":"zh","ک":"k","ی":"y","َ":"a","ً":"an","ِ":"e","ٍ":"en","ُ":"u","ٌ":"on","ْ":"","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","က":"k","ခ":"kh","ဂ":"g","ဃ":"ga","င":"ng","စ":"s","ဆ":"sa","ဇ":"z","စျ":"za","ည":"ny","ဋ":"t","ဌ":"ta","ဍ":"d","ဎ":"da","ဏ":"na","တ":"t","ထ":"ta","ဒ":"d","ဓ":"da","န":"n","ပ":"p","ဖ":"pa","ဗ":"b","ဘ":"ba","မ":"m","ယ":"y","ရ":"ya","လ":"l","ဝ":"w","သ":"th","ဟ":"h","ဠ":"la","အ":"a","ြ":"y","ျ":"ya","ွ":"w","ြွ":"yw","ျွ":"ywa","ှ":"h","ဧ":"e","၏":"-e","ဣ":"i","ဤ":"-i","ဉ":"u","ဦ":"-u","ဩ":"aw","သြော":"aw","ဪ":"aw","၀":"0","၁":"1","၂":"2","၃":"3","၄":"4","၅":"5","၆":"6","၇":"7","၈":"8","၉":"9","္":"","့":"","း":"","č":"c","ď":"d","ě":"e","ň":"n","ř":"r","š":"s","ť":"t","ů":"u","ž":"z","Č":"C","Ď":"D","Ě":"E","Ň":"N","Ř":"R","Š":"S","Ť":"T","Ů":"U","Ž":"Z","ހ":"h","ށ":"sh","ނ":"n","ރ":"r","ބ":"b","ޅ":"lh","ކ":"k","އ":"a","ވ":"v","މ":"m","ފ":"f","ދ":"dh","ތ":"th","ލ":"l","ގ":"g","ޏ":"gn","ސ":"s","ޑ":"d","ޒ":"z","ޓ":"t","ޔ":"y","ޕ":"p","ޖ":"j","ޗ":"ch","ޘ":"tt","ޙ":"hh","ޚ":"kh","ޛ":"th","ޜ":"z","ޝ":"sh","ޞ":"s","ޟ":"d","ޠ":"t","ޡ":"z","ޢ":"a","ޣ":"gh","ޤ":"q","ޥ":"w","ަ":"a","ާ":"aa","ި":"i","ީ":"ee","ު":"u","ޫ":"oo","ެ":"e","ޭ":"ey","ޮ":"o","ޯ":"oa","ް":"","ა":"a","ბ":"b","გ":"g","დ":"d","ე":"e","ვ":"v","ზ":"z","თ":"t","ი":"i","კ":"k","ლ":"l","მ":"m","ნ":"n","ო":"o","პ":"p","ჟ":"zh","რ":"r","ს":"s","ტ":"t","უ":"u","ფ":"p","ქ":"k","ღ":"gh","ყ":"q","შ":"sh","ჩ":"ch","ც":"ts","ძ":"dz","წ":"ts","ჭ":"ch","ხ":"kh","ჯ":"j","ჰ":"h","α":"a","β":"v","γ":"g","δ":"d","ε":"e","ζ":"z","η":"i","θ":"th","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"ks","ο":"o","π":"p","ρ":"r","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"o","ά":"a","έ":"e","ί":"i","ό":"o","ύ":"y","ή":"i","ώ":"o","ς":"s","ϊ":"i","ΰ":"y","ϋ":"y","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"I","Θ":"TH","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"KS","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"O","Ά":"A","Έ":"E","Ί":"I","Ό":"O","Ύ":"Y","Ή":"I","Ώ":"O","Ϊ":"I","Ϋ":"Y","ā":"a","ē":"e","ģ":"g","ī":"i","ķ":"k","ļ":"l","ņ":"n","ū":"u","Ā":"A","Ē":"E","Ģ":"G","Ī":"I","Ķ":"k","Ļ":"L","Ņ":"N","Ū":"U","Ќ":"Kj","ќ":"kj","Љ":"Lj","љ":"lj","Њ":"Nj","њ":"nj","Тс":"Ts","тс":"ts","ą":"a","ć":"c","ę":"e","ł":"l","ń":"n","ś":"s","ź":"z","ż":"z","Ą":"A","Ć":"C","Ę":"E","Ł":"L","Ń":"N","Ś":"S","Ź":"Z","Ż":"Z","Є":"Ye","І":"I","Ї":"Yi","Ґ":"G","є":"ye","і":"i","ї":"yi","ґ":"g","ă":"a","Ă":"A","ș":"s","Ș":"S","ț":"t","Ț":"T","ţ":"t","Ţ":"T","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ё":"yo","ж":"zh","з":"z","и":"i","й":"i","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"kh","ц":"c","ч":"ch","ш":"sh","щ":"sh","ъ":"","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ё":"Yo","Ж":"Zh","З":"Z","И":"I","Й":"I","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"Kh","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya","ђ":"dj","ј":"j","ћ":"c","џ":"dz","Ђ":"Dj","Ј":"j","Ћ":"C","Џ":"Dz","ľ":"l","ĺ":"l","ŕ":"r","Ľ":"L","Ĺ":"L","Ŕ":"R","ş":"s","Ş":"S","ı":"i","İ":"I","ğ":"g","Ğ":"G","ả":"a","Ả":"A","ẳ":"a","Ẳ":"A","ẩ":"a","Ẩ":"A","đ":"d","Đ":"D","ẹ":"e","Ẹ":"E","ẽ":"e","Ẽ":"E","ẻ":"e","Ẻ":"E","ế":"e","Ế":"E","ề":"e","Ề":"E","ệ":"e","Ệ":"E","ễ":"e","Ễ":"E","ể":"e","Ể":"E","ỏ":"o","ọ":"o","Ọ":"o","ố":"o","Ố":"O","ồ":"o","Ồ":"O","ổ":"o","Ổ":"O","ộ":"o","Ộ":"O","ỗ":"o","Ỗ":"O","ơ":"o","Ơ":"O","ớ":"o","Ớ":"O","ờ":"o","Ờ":"O","ợ":"o","Ợ":"O","ỡ":"o","Ỡ":"O","Ở":"o","ở":"o","ị":"i","Ị":"I","ĩ":"i","Ĩ":"I","ỉ":"i","Ỉ":"i","ủ":"u","Ủ":"U","ụ":"u","Ụ":"U","ũ":"u","Ũ":"U","ư":"u","Ư":"U","ứ":"u","Ứ":"U","ừ":"u","Ừ":"U","ự":"u","Ự":"U","ữ":"u","Ữ":"U","ử":"u","Ử":"ư","ỷ":"y","Ỷ":"y","ỳ":"y","Ỳ":"Y","ỵ":"y","Ỵ":"Y","ỹ":"y","Ỹ":"Y","ạ":"a","Ạ":"A","ấ":"a","Ấ":"A","ầ":"a","Ầ":"A","ậ":"a","Ậ":"A","ẫ":"a","Ẫ":"A","ắ":"a","Ắ":"A","ằ":"a","Ằ":"A","ặ":"a","Ặ":"A","ẵ":"a","Ẵ":"A","⓪":"0","①":"1","②":"2","③":"3","④":"4","⑤":"5","⑥":"6","⑦":"7","⑧":"8","⑨":"9","⑩":"10","⑪":"11","⑫":"12","⑬":"13","⑭":"14","⑮":"15","⑯":"16","⑰":"17","⑱":"18","⑲":"18","⑳":"18","⓵":"1","⓶":"2","⓷":"3","⓸":"4","⓹":"5","⓺":"6","⓻":"7","⓼":"8","⓽":"9","⓾":"10","⓿":"0","⓫":"11","⓬":"12","⓭":"13","⓮":"14","⓯":"15","⓰":"16","⓱":"17","⓲":"18","⓳":"19","⓴":"20","Ⓐ":"A","Ⓑ":"B","Ⓒ":"C","Ⓓ":"D","Ⓔ":"E","Ⓕ":"F","Ⓖ":"G","Ⓗ":"H","Ⓘ":"I","Ⓙ":"J","Ⓚ":"K","Ⓛ":"L","Ⓜ":"M","Ⓝ":"N","Ⓞ":"O","Ⓟ":"P","Ⓠ":"Q","Ⓡ":"R","Ⓢ":"S","Ⓣ":"T","Ⓤ":"U","Ⓥ":"V","Ⓦ":"W","Ⓧ":"X","Ⓨ":"Y","Ⓩ":"Z","ⓐ":"a","ⓑ":"b","ⓒ":"c","ⓓ":"d","ⓔ":"e","ⓕ":"f","ⓖ":"g","ⓗ":"h","ⓘ":"i","ⓙ":"j","ⓚ":"k","ⓛ":"l","ⓜ":"m","ⓝ":"n","ⓞ":"o","ⓟ":"p","ⓠ":"q","ⓡ":"r","ⓢ":"s","ⓣ":"t","ⓤ":"u","ⓦ":"v","ⓥ":"w","ⓧ":"x","ⓨ":"y","ⓩ":"z","“":'"',"”":'"',"‘":"'","’":"'","∂":"d","ƒ":"f","™":"(TM)","©":"(C)","œ":"oe","Œ":"OE","®":"(R)","†":"+","℠":"(SM)","…":"...","˚":"o","º":"o","ª":"a","•":"*","၊":",","။":".",$:"USD","€":"EUR","₢":"BRN","₣":"FRF","£":"GBP","₤":"ITL","₦":"NGN","₧":"ESP","₩":"KRW","₪":"ILS","₫":"VND","₭":"LAK","₮":"MNT","₯":"GRD","₱":"ARS","₲":"PYG","₳":"ARA","₴":"UAH","₵":"GHS","¢":"cent","¥":"CNY","元":"CNY","円":"YEN","﷼":"IRR","₠":"EWE","฿":"THB","₨":"INR","₹":"INR","₰":"PF","₺":"TRY","؋":"AFN","₼":"AZN","лв":"BGN","៛":"KHR","₡":"CRC","₸":"KZT","ден":"MKD","zł":"PLN","₽":"RUB","₾":"GEL"},n=["်","ް"],t={"ာ":"a","ါ":"a","ေ":"e","ဲ":"e","ိ":"i","ီ":"i","ို":"o","ု":"u","ူ":"u","ေါင်":"aung","ော":"aw","ော်":"aw","ေါ":"aw","ေါ်":"aw","်":"်","က်":"et","ိုက်":"aik","ောက်":"auk","င်":"in","ိုင်":"aing","ောင်":"aung","စ်":"it","ည်":"i","တ်":"at","ိတ်":"eik","ုတ်":"ok","ွတ်":"ut","ေတ်":"it","ဒ်":"d","ိုဒ်":"ok","ုဒ်":"ait","န်":"an","ာန်":"an","ိန်":"ein","ုန်":"on","ွန်":"un","ပ်":"at","ိပ်":"eik","ုပ်":"ok","ွပ်":"ut","န်ုပ်":"nub","မ်":"an","ိမ်":"ein","ုမ်":"on","ွမ်":"un","ယ်":"e","ိုလ်":"ol","ဉ်":"in","ံ":"an","ိံ":"ein","ုံ":"on","ައް":"ah","ަށް":"ah"},i={en:{},az:{"ç":"c","ə":"e","ğ":"g","ı":"i","ö":"o","ş":"s","ü":"u","Ç":"C","Ə":"E","Ğ":"G","İ":"I","Ö":"O","Ş":"S","Ü":"U"},cs:{"č":"c","ď":"d","ě":"e","ň":"n","ř":"r","š":"s","ť":"t","ů":"u","ž":"z","Č":"C","Ď":"D","Ě":"E","Ň":"N","Ř":"R","Š":"S","Ť":"T","Ů":"U","Ž":"Z"},fi:{"ä":"a","Ä":"A","ö":"o","Ö":"O"},hu:{"ä":"a","Ä":"A","ö":"o","Ö":"O","ü":"u","Ü":"U","ű":"u","Ű":"U"},lt:{"ą":"a","č":"c","ę":"e","ė":"e","į":"i","š":"s","ų":"u","ū":"u","ž":"z","Ą":"A","Č":"C","Ę":"E","Ė":"E","Į":"I","Š":"S","Ų":"U","Ū":"U"},lv:{"ā":"a","č":"c","ē":"e","ģ":"g","ī":"i","ķ":"k","ļ":"l","ņ":"n","š":"s","ū":"u","ž":"z","Ā":"A","Č":"C","Ē":"E","Ģ":"G","Ī":"i","Ķ":"k","Ļ":"L","Ņ":"N","Š":"S","Ū":"u","Ž":"Z"},pl:{"ą":"a","ć":"c","ę":"e","ł":"l","ń":"n","ó":"o","ś":"s","ź":"z","ż":"z","Ą":"A","Ć":"C","Ę":"e","Ł":"L","Ń":"N","Ó":"O","Ś":"S","Ź":"Z","Ż":"Z"},sv:{"ä":"a","Ä":"A","ö":"o","Ö":"O"},sk:{"ä":"a","Ä":"A"},sr:{"љ":"lj","њ":"nj","Љ":"Lj","Њ":"Nj","đ":"dj","Đ":"Dj"},tr:{"Ü":"U","Ö":"O","ü":"u","ö":"o"}},o={ar:{"∆":"delta","∞":"la-nihaya","♥":"hob","&":"wa","|":"aw","<":"aqal-men",">":"akbar-men","∑":"majmou","¤":"omla"},az:{},ca:{"∆":"delta","∞":"infinit","♥":"amor","&":"i","|":"o","<":"menys que",">":"mes que","∑":"suma dels","¤":"moneda"},cs:{"∆":"delta","∞":"nekonecno","♥":"laska","&":"a","|":"nebo","<":"mensi nez",">":"vetsi nez","∑":"soucet","¤":"mena"},de:{"∆":"delta","∞":"unendlich","♥":"Liebe","&":"und","|":"oder","<":"kleiner als",">":"groesser als","∑":"Summe von","¤":"Waehrung"},dv:{"∆":"delta","∞":"kolunulaa","♥":"loabi","&":"aai","|":"noonee","<":"ah vure kuda",">":"ah vure bodu","∑":"jumula","¤":"faisaa"},en:{"∆":"delta","∞":"infinity","♥":"love","&":"and","|":"or","<":"less than",">":"greater than","∑":"sum","¤":"currency"},es:{"∆":"delta","∞":"infinito","♥":"amor","&":"y","|":"u","<":"menos que",">":"mas que","∑":"suma de los","¤":"moneda"},fa:{"∆":"delta","∞":"bi-nahayat","♥":"eshgh","&":"va","|":"ya","<":"kamtar-az",">":"bishtar-az","∑":"majmooe","¤":"vahed"},fi:{"∆":"delta","∞":"aarettomyys","♥":"rakkaus","&":"ja","|":"tai","<":"pienempi kuin",">":"suurempi kuin","∑":"summa","¤":"valuutta"},fr:{"∆":"delta","∞":"infiniment","♥":"Amour","&":"et","|":"ou","<":"moins que",">":"superieure a","∑":"somme des","¤":"monnaie"},ge:{"∆":"delta","∞":"usasruloba","♥":"siqvaruli","&":"da","|":"an","<":"naklebi",">":"meti","∑":"jami","¤":"valuta"},gr:{},hu:{"∆":"delta","∞":"vegtelen","♥":"szerelem","&":"es","|":"vagy","<":"kisebb mint",">":"nagyobb mint","∑":"szumma","¤":"penznem"},it:{"∆":"delta","∞":"infinito","♥":"amore","&":"e","|":"o","<":"minore di",">":"maggiore di","∑":"somma","¤":"moneta"},lt:{"∆":"delta","∞":"begalybe","♥":"meile","&":"ir","|":"ar","<":"maziau nei",">":"daugiau nei","∑":"suma","¤":"valiuta"},lv:{"∆":"delta","∞":"bezgaliba","♥":"milestiba","&":"un","|":"vai","<":"mazak neka",">":"lielaks neka","∑":"summa","¤":"valuta"},my:{"∆":"kwahkhyaet","∞":"asaonasme","♥":"akhyait","&":"nhin","|":"tho","<":"ngethaw",">":"kyithaw","∑":"paungld","¤":"ngwekye"},mk:{},nl:{"∆":"delta","∞":"oneindig","♥":"liefde","&":"en","|":"of","<":"kleiner dan",">":"groter dan","∑":"som","¤":"valuta"},pl:{"∆":"delta","∞":"nieskonczonosc","♥":"milosc","&":"i","|":"lub","<":"mniejsze niz",">":"wieksze niz","∑":"suma","¤":"waluta"},pt:{"∆":"delta","∞":"infinito","♥":"amor","&":"e","|":"ou","<":"menor que",">":"maior que","∑":"soma","¤":"moeda"},ro:{"∆":"delta","∞":"infinit","♥":"dragoste","&":"si","|":"sau","<":"mai mic ca",">":"mai mare ca","∑":"suma","¤":"valuta"},ru:{"∆":"delta","∞":"beskonechno","♥":"lubov","&":"i","|":"ili","<":"menshe",">":"bolshe","∑":"summa","¤":"valjuta"},sk:{"∆":"delta","∞":"nekonecno","♥":"laska","&":"a","|":"alebo","<":"menej ako",">":"viac ako","∑":"sucet","¤":"mena"},sr:{},tr:{"∆":"delta","∞":"sonsuzluk","♥":"ask","&":"ve","|":"veya","<":"kucuktur",">":"buyuktur","∑":"toplam","¤":"para birimi"},uk:{"∆":"delta","∞":"bezkinechnist","♥":"lubov","&":"i","|":"abo","<":"menshe",">":"bilshe","∑":"suma","¤":"valjuta"},vn:{"∆":"delta","∞":"vo cuc","♥":"yeu","&":"va","|":"hoac","<":"nho hon",">":"lon hon","∑":"tong","¤":"tien te"}},u=[";","?",":","@","&","=","+","$",",","/"].join(""),s=[";","?",":","@","&","=","+","$",","].join(""),l=[".","!","~","*","'","(",")"].join(""),r=function(a,r){var m,d,g,k,y,f,p,z,b,A,v,E,O,j,S="-",w="",U="",C=!0,N={},R="";if("string"!=typeof a)return"";if("string"==typeof r&&(S=r),p=o.en,z=i.en,"object"==typeof r){m=r.maintainCase||!1,N=r.custom&&"object"==typeof r.custom?r.custom:N,g=+r.truncate>1&&r.truncate||!1,k=r.uric||!1,y=r.uricNoSlash||!1,f=r.mark||!1,C=!1!==r.symbols&&!1!==r.lang,S=r.separator||S,k&&(R+=u),y&&(R+=s),f&&(R+=l),p=r.lang&&o[r.lang]&&C?o[r.lang]:C?o.en:{},z=r.lang&&i[r.lang]?i[r.lang]:!1===r.lang||!0===r.lang?{}:i.en,r.titleCase&&"number"==typeof r.titleCase.length&&Array.prototype.toString.call(r.titleCase)?(r.titleCase.forEach(function(a){N[a+""]=a+""}),d=!0):d=!!r.titleCase,r.custom&&"number"==typeof r.custom.length&&Array.prototype.toString.call(r.custom)&&r.custom.forEach(function(a){N[a+""]=a+""}),Object.keys(N).forEach(function(e){var n;n=e.length>1?new RegExp("\\b"+h(e)+"\\b","gi"):new RegExp(h(e),"gi"),a=a.replace(n,N[e])});for(v in N)R+=v}for(R=h(R+=S),O=!1,j=!1,A=0,E=(a=a.replace(/(^\s+|\s+$)/g,"")).length;A=0?(U+=v,v=""):!0===j?(v=t[U]+e[v],U=""):v=O&&e[v].match(/[A-Za-z0-9]/)?" "+e[v]:e[v],O=!1,j=!1):v in t?(U+=v,v="",A===E-1&&(v=t[U]),j=!0):!p[v]||k&&-1!==u.indexOf(v)||y&&-1!==s.indexOf(v)?(!0===j?(v=t[U]+v,U="",j=!1):O&&(/[A-Za-z0-9]/.test(v)||w.substr(-1).match(/A-Za-z0-9]/))&&(v=" "+v),O=!1):(v=O||w.substr(-1).match(/[A-Za-z0-9]/)?S+p[v]:p[v],v+=void 0!==a[A+1]&&a[A+1].match(/[A-Za-z0-9]/)?S:"",O=!0),w+=v.replace(new RegExp("[^\\w\\s"+R+"_-]","g"),S);return d&&(w=w.replace(/(\w)(\S*)/g,function(a,e,n){var t=e.toUpperCase()+(null!==n?n:"");return Object.keys(N).indexOf(t.toLowerCase())<0?t:t.toLowerCase()})),w=w.replace(/\s+/g,S).replace(new RegExp("\\"+S+"+","g"),S).replace(new RegExp("(^\\"+S+"+|\\"+S+"+$)","g"),""),g&&w.length>g&&(b=w.charAt(g)===S,w=w.slice(0,g),b||(w=w.slice(0,w.lastIndexOf(S)))),m||d||(w=w.toLowerCase()),w},m=function(a){return function(e){return r(e,a)}},h=function(a){return a.replace(/[-\\^$*+?.()|[\]{}\/]/g,"\\$&")},c=function(a,e){for(var n in e)if(e[n]===a)return!0};if("undefined"!=typeof module&&module.exports)module.exports=r,module.exports.createSlug=m;else if("undefined"!=typeof define&&define.amd)define([],function(){return r});else try{if(a.getSlug||a.createSlug)throw"speakingurl: globals exists /(getSlug|createSlug)/";a.getSlug=r,a.createSlug=m}catch(a){}}(this); (function (root, undef){ var ArrayProto=Array.prototype, ObjProto=Object.prototype, slice=ArrayProto.slice, hasOwnProp=ObjProto.hasOwnProperty, nativeForEach=ArrayProto.forEach, breaker={}; var _={ forEach:function(obj, iterator, context){ var i, l, key; if(obj===null){ return; } if(nativeForEach&&obj.forEach===nativeForEach){ obj.forEach(iterator, context); } else if(obj.length===+obj.length){ for(i=0, l=obj.length; i < l; i++){ if(i in obj&&iterator.call(context, obj[i], i, obj)===breaker){ return; }} }else{ for(key in obj){ if(hasOwnProp.call(obj, key)){ if(iterator.call (context, obj[key], key, obj)===breaker){ return; }} }} }, extend:function(obj){ this.forEach(slice.call(arguments, 1), function(source){ for(var prop in source){ obj[prop]=source[prop]; }}); return obj; }}; var Jed=function(options){ this.defaults={ "locale_data":{ "messages":{ "":{ "domain":"messages", "lang":"en", "plural_forms":"nplurals=2; plural=(n!=1);" }} }, "domain":"messages", "debug":false }; this.options=_.extend({}, this.defaults, options); this.textdomain(this.options.domain); if(options.domain&&! this.options.locale_data[ this.options.domain ]){ throw new Error('Text domain set to non-existent domain: `' + options.domain + '`'); }}; Jed.context_delimiter=String.fromCharCode(4); function getPluralFormFunc(plural_form_string){ return Jed.PF.compile(plural_form_string||"nplurals=2; plural=(n!=1);"); } function Chain(key, i18n){ this._key=key; this._i18n=i18n; } _.extend(Chain.prototype, { onDomain:function(domain){ this._domain=domain; return this; }, withContext:function(context){ this._context=context; return this; }, ifPlural:function(num, pkey){ this._val=num; this._pkey=pkey; return this; }, fetch:function(sArr){ if({}.toString.call(sArr)!='[object Array]'){ sArr=[].slice.call(arguments, 0); } return(sArr&&sArr.length ? Jed.sprintf:function(x){ return x; })( this._i18n.dcnpgettext(this._domain, this._context, this._key, this._pkey, this._val), sArr ); }}); _.extend(Jed.prototype, { translate:function(key){ return new Chain(key, this); }, textdomain:function(domain){ if(! domain){ return this._textdomain; } this._textdomain=domain; }, gettext:function(key){ return this.dcnpgettext.call(this, undef, undef, key); }, dgettext:function(domain, key){ return this.dcnpgettext.call(this, domain, undef, key); }, dcgettext:function(domain , key ){ return this.dcnpgettext.call(this, domain, undef, key); }, ngettext:function(skey, pkey, val){ return this.dcnpgettext.call(this, undef, undef, skey, pkey, val); }, dngettext:function(domain, skey, pkey, val){ return this.dcnpgettext.call(this, domain, undef, skey, pkey, val); }, dcngettext:function(domain, skey, pkey, val){ return this.dcnpgettext.call(this, domain, undef, skey, pkey, val); }, pgettext:function(context, key){ return this.dcnpgettext.call(this, undef, context, key); }, dpgettext:function(domain, context, key){ return this.dcnpgettext.call(this, domain, context, key); }, dcpgettext:function(domain, context, key){ return this.dcnpgettext.call(this, domain, context, key); }, npgettext:function(context, skey, pkey, val){ return this.dcnpgettext.call(this, undef, context, skey, pkey, val); }, dnpgettext:function(domain, context, skey, pkey, val){ return this.dcnpgettext.call(this, domain, context, skey, pkey, val); }, dcnpgettext:function(domain, context, singular_key, plural_key, val){ plural_key=plural_key||singular_key; domain=domain||this._textdomain; var fallback; if(! this.options){ fallback=new Jed(); return fallback.dcnpgettext.call(fallback, undefined, undefined, singular_key, plural_key, val); } if(! this.options.locale_data){ throw new Error('No locale data provided.'); } if(! this.options.locale_data[ domain ]){ throw new Error('Domain `' + domain + '` was not found.'); } if(! this.options.locale_data[ domain ][ "" ]){ throw new Error('No locale meta information provided.'); } if(! singular_key){ throw new Error('No translation key found.'); } var key=context ? context + Jed.context_delimiter + singular_key:singular_key, locale_data=this.options.locale_data, dict=locale_data[ domain ], defaultConf=(locale_data.messages||this.defaults.locale_data.messages)[""], pluralForms=dict[""].plural_forms||dict[""]["Plural-Forms"]||dict[""]["plural-forms"]||defaultConf.plural_forms||defaultConf["Plural-Forms"]||defaultConf["plural-forms"], val_list, res; var val_idx; if(val===undefined){ val_idx=0; }else{ if(typeof val!='number'){ val=parseInt(val, 10); if(isNaN(val)){ throw new Error('The number that was passed in is not a number.'); }} val_idx=getPluralFormFunc(pluralForms)(val); } if(! dict){ throw new Error('No domain named `' + domain + '` could be found.'); } val_list=dict[ key ]; if(! val_list||val_idx > val_list.length){ if(this.options.missing_key_callback){ this.options.missing_key_callback(key, domain); } res=[ singular_key, plural_key ]; if(this.options.debug===true){ console.log(res[ getPluralFormFunc(pluralForms)(val) ]); } return res[ getPluralFormFunc()(val) ]; } res=val_list[ val_idx ]; if(! res){ res=[ singular_key, plural_key ]; return res[ getPluralFormFunc()(val) ]; } return res; }}); var sprintf=(function(){ function get_type(variable){ return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase(); } function str_repeat(input, multiplier){ for (var output=[]; multiplier > 0; output[--multiplier]=input){} return output.join(''); } var str_format=function(){ if(!str_format.cache.hasOwnProperty(arguments[0])){ str_format.cache[arguments[0]]=str_format.parse(arguments[0]); } return str_format.format.call(null, str_format.cache[arguments[0]], arguments); }; str_format.format=function(parse_tree, argv){ var cursor=1, tree_length=parse_tree.length, node_type='', arg, output=[], i, k, match, pad, pad_character, pad_length; for (i=0; i < tree_length; i++){ node_type=get_type(parse_tree[i]); if(node_type==='string'){ output.push(parse_tree[i]); } else if(node_type==='array'){ match=parse_tree[i]; if(match[2]){ arg=argv[cursor]; for (k=0; k < match[2].length; k++){ if(!arg.hasOwnProperty(match[2][k])){ throw(sprintf('[sprintf] property "%s" does not exist', match[2][k])); } arg=arg[match[2][k]]; }} else if(match[1]){ arg=argv[match[1]]; }else{ arg=argv[cursor++]; } if(/[^s]/.test(match[8])&&(get_type(arg)!='number')){ throw(sprintf('[sprintf] expecting number but found %s', get_type(arg))); } if(typeof arg=='undefined'||arg===null){ arg=''; } switch (match[8]){ case 'b': arg=arg.toString(2); break; case 'c': arg=String.fromCharCode(arg); break; case 'd': arg=parseInt(arg, 10); break; case 'e': arg=match[7] ? arg.toExponential(match[7]):arg.toExponential(); break; case 'f': arg=match[7] ? parseFloat(arg).toFixed(match[7]):parseFloat(arg); break; case 'o': arg=arg.toString(8); break; case 's': arg=((arg=String(arg))&&match[7] ? arg.substring(0, match[7]):arg); break; case 'u': arg=Math.abs(arg); break; case 'x': arg=arg.toString(16); break; case 'X': arg=arg.toString(16).toUpperCase(); break; } arg=(/[def]/.test(match[8])&&match[3]&&arg >=0 ? '+'+ arg:arg); pad_character=match[4] ? match[4]=='0' ? '0':match[4].charAt(1):' '; pad_length=match[6] - String(arg).length; pad=match[6] ? str_repeat(pad_character, pad_length):''; output.push(match[5] ? arg + pad:pad + arg); }} return output.join(''); }; str_format.cache={}; str_format.parse=function(fmt){ var _fmt=fmt, match=[], parse_tree=[], arg_names=0; while (_fmt){ if((match=/^[^\x25]+/.exec(_fmt))!==null){ parse_tree.push(match[0]); } else if((match=/^\x25{2}/.exec(_fmt))!==null){ parse_tree.push('%'); } else if((match=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt))!==null){ if(match[2]){ arg_names |=1; var field_list=[], replacement_field=match[2], field_match=[]; if((field_match=/^([a-z_][a-z_\d]*)/i.exec(replacement_field))!==null){ field_list.push(field_match[1]); while ((replacement_field=replacement_field.substring(field_match[0].length))!==''){ if((field_match=/^\.([a-z_][a-z_\d]*)/i.exec(replacement_field))!==null){ field_list.push(field_match[1]); } else if((field_match=/^\[(\d+)\]/.exec(replacement_field))!==null){ field_list.push(field_match[1]); }else{ throw('[sprintf] huh?'); }} }else{ throw('[sprintf] huh?'); } match[2]=field_list; }else{ arg_names |=2; } if(arg_names===3){ throw('[sprintf] mixing positional and named placeholders is not (yet) supported'); } parse_tree.push(match); }else{ throw('[sprintf] huh?'); } _fmt=_fmt.substring(match[0].length); } return parse_tree; }; return str_format; })(); var vsprintf=function(fmt, argv){ argv.unshift(fmt); return sprintf.apply(null, argv); }; Jed.parse_plural=function(plural_forms, n){ plural_forms=plural_forms.replace(/n/g, n); return Jed.parse_expression(plural_forms); }; Jed.sprintf=function(fmt, args){ if({}.toString.call(args)=='[object Array]'){ return vsprintf(fmt, [].slice.call(args)); } return sprintf.apply(this, [].slice.call(arguments)); }; Jed.prototype.sprintf=function (){ return Jed.sprintf.apply(this, arguments); }; Jed.PF={}; Jed.PF.parse=function(p){ var plural_str=Jed.PF.extractPluralExpr(p); return Jed.PF.parser.parse.call(Jed.PF.parser, plural_str); }; Jed.PF.compile=function(p){ function imply(val){ return (val===true ? 1:val ? val:0); } var ast=Jed.PF.parse(p); return function(n){ return imply(Jed.PF.interpreter(ast)(n)); };}; Jed.PF.interpreter=function(ast){ return function(n){ var res; switch(ast.type){ case 'GROUP': return Jed.PF.interpreter(ast.expr)(n); case 'TERNARY': if(Jed.PF.interpreter(ast.expr)(n)){ return Jed.PF.interpreter(ast.truthy)(n); } return Jed.PF.interpreter(ast.falsey)(n); case 'OR': return Jed.PF.interpreter(ast.left)(n)||Jed.PF.interpreter(ast.right)(n); case 'AND': return Jed.PF.interpreter(ast.left)(n)&&Jed.PF.interpreter(ast.right)(n); case 'LT': return Jed.PF.interpreter(ast.left)(n) < Jed.PF.interpreter(ast.right)(n); case 'GT': return Jed.PF.interpreter(ast.left)(n) > Jed.PF.interpreter(ast.right)(n); case 'LTE': return Jed.PF.interpreter(ast.left)(n) <=Jed.PF.interpreter(ast.right)(n); case 'GTE': return Jed.PF.interpreter(ast.left)(n) >=Jed.PF.interpreter(ast.right)(n); case 'EQ': return Jed.PF.interpreter(ast.left)(n)==Jed.PF.interpreter(ast.right)(n); case 'NEQ': return Jed.PF.interpreter(ast.left)(n)!=Jed.PF.interpreter(ast.right)(n); case 'MOD': return Jed.PF.interpreter(ast.left)(n) % Jed.PF.interpreter(ast.right)(n); case 'VAR': return n; case 'NUM': return ast.val; default: throw new Error("Invalid Token found."); }};}; Jed.PF.regexps={ TRIM_BEG: /^\s\s*/, TRIM_END: /\s\s*$/, HAS_SEMICOLON: /;\s*$/, NPLURALS: /nplurals\=(\d+);/, PLURAL: /plural\=(.*);/ }; Jed.PF.extractPluralExpr=function(p){ p=p.replace(Jed.PF.regexps.TRIM_BEG, '').replace(Jed.PF.regexps.TRIM_END, ''); if(! Jed.PF.regexps.HAS_SEMICOLON.test(p)){ p=p.concat(';'); } var nplurals_matches=p.match(Jed.PF.regexps.NPLURALS), res={}, plural_matches; if(nplurals_matches.length > 1){ res.nplurals=nplurals_matches[1]; }else{ throw new Error('nplurals not found in plural_forms string: ' + p); } p=p.replace(Jed.PF.regexps.NPLURALS, ""); plural_matches=p.match(Jed.PF.regexps.PLURAL); if(!(plural_matches&&plural_matches.length > 1)){ throw new Error('`plural` expression not found: ' + p); } return plural_matches[ 1 ]; }; Jed.PF.parser=(function(){ var parser={trace: function trace(){ }, yy: {}, symbols_: {"error":2,"expressions":3,"e":4,"EOF":5,"?":6,":":7,"||":8,"&&":9,"<":10,"<=":11,">":12,">=":13,"!=":14,"==":15,"%":16,"(":17,")":18,"n":19,"NUMBER":20,"$accept":0,"$end":1}, terminals_: {2:"error",5:"EOF",6:"?",7:":",8:"||",9:"&&",10:"<",11:"<=",12:">",13:">=",14:"!=",15:"==",16:"%",17:"(",18:")",19:"n",20:"NUMBER"}, productions_: [0,[3,2],[4,5],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,1],[4,1]], performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$){ var $0=$$.length - 1; switch (yystate){ case 1: return { type:'GROUP', expr: $$[$0-1] }; break; case 2:this.$={ type: 'TERNARY', expr: $$[$0-4], truthy:$$[$0-2], falsey: $$[$0] }; break; case 3:this.$={ type: "OR", left: $$[$0-2], right: $$[$0] }; break; case 4:this.$={ type: "AND", left: $$[$0-2], right: $$[$0] }; break; case 5:this.$={ type: 'LT', left: $$[$0-2], right: $$[$0] }; break; case 6:this.$={ type: 'LTE', left: $$[$0-2], right: $$[$0] }; break; case 7:this.$={ type: 'GT', left: $$[$0-2], right: $$[$0] }; break; case 8:this.$={ type: 'GTE', left: $$[$0-2], right: $$[$0] }; break; case 9:this.$={ type: 'NEQ', left: $$[$0-2], right: $$[$0] }; break; case 10:this.$={ type: 'EQ', left: $$[$0-2], right: $$[$0] }; break; case 11:this.$={ type: 'MOD', left: $$[$0-2], right: $$[$0] }; break; case 12:this.$={ type: 'GROUP', expr: $$[$0-1] }; break; case 13:this.$={ type: 'VAR' }; break; case 14:this.$={ type: 'NUM', val: Number(yytext) }; break; }}, table: [{3:1,4:2,17:[1,3],19:[1,4],20:[1,5]},{1:[3]},{5:[1,6],6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{4:17,17:[1,3],19:[1,4],20:[1,5]},{5:[2,13],6:[2,13],7:[2,13],8:[2,13],9:[2,13],10:[2,13],11:[2,13],12:[2,13],13:[2,13],14:[2,13],15:[2,13],16:[2,13],18:[2,13]},{5:[2,14],6:[2,14],7:[2,14],8:[2,14],9:[2,14],10:[2,14],11:[2,14],12:[2,14],13:[2,14],14:[2,14],15:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{4:18,17:[1,3],19:[1,4],20:[1,5]},{4:19,17:[1,3],19:[1,4],20:[1,5]},{4:20,17:[1,3],19:[1,4],20:[1,5]},{4:21,17:[1,3],19:[1,4],20:[1,5]},{4:22,17:[1,3],19:[1,4],20:[1,5]},{4:23,17:[1,3],19:[1,4],20:[1,5]},{4:24,17:[1,3],19:[1,4],20:[1,5]},{4:25,17:[1,3],19:[1,4],20:[1,5]},{4:26,17:[1,3],19:[1,4],20:[1,5]},{4:27,17:[1,3],19:[1,4],20:[1,5]},{6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[1,28]},{6:[1,7],7:[1,29],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{5:[2,3],6:[2,3],7:[2,3],8:[2,3],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,3]},{5:[2,4],6:[2,4],7:[2,4],8:[2,4],9:[2,4],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,4]},{5:[2,5],6:[2,5],7:[2,5],8:[2,5],9:[2,5],10:[2,5],11:[2,5],12:[2,5],13:[2,5],14:[2,5],15:[2,5],16:[1,16],18:[2,5]},{5:[2,6],6:[2,6],7:[2,6],8:[2,6],9:[2,6],10:[2,6],11:[2,6],12:[2,6],13:[2,6],14:[2,6],15:[2,6],16:[1,16],18:[2,6]},{5:[2,7],6:[2,7],7:[2,7],8:[2,7],9:[2,7],10:[2,7],11:[2,7],12:[2,7],13:[2,7],14:[2,7],15:[2,7],16:[1,16],18:[2,7]},{5:[2,8],6:[2,8],7:[2,8],8:[2,8],9:[2,8],10:[2,8],11:[2,8],12:[2,8],13:[2,8],14:[2,8],15:[2,8],16:[1,16],18:[2,8]},{5:[2,9],6:[2,9],7:[2,9],8:[2,9],9:[2,9],10:[2,9],11:[2,9],12:[2,9],13:[2,9],14:[2,9],15:[2,9],16:[1,16],18:[2,9]},{5:[2,10],6:[2,10],7:[2,10],8:[2,10],9:[2,10],10:[2,10],11:[2,10],12:[2,10],13:[2,10],14:[2,10],15:[2,10],16:[1,16],18:[2,10]},{5:[2,11],6:[2,11],7:[2,11],8:[2,11],9:[2,11],10:[2,11],11:[2,11],12:[2,11],13:[2,11],14:[2,11],15:[2,11],16:[2,11],18:[2,11]},{5:[2,12],6:[2,12],7:[2,12],8:[2,12],9:[2,12],10:[2,12],11:[2,12],12:[2,12],13:[2,12],14:[2,12],15:[2,12],16:[2,12],18:[2,12]},{4:30,17:[1,3],19:[1,4],20:[1,5]},{5:[2,2],6:[1,7],7:[2,2],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,2]}], defaultActions: {6:[2,1]}, parseError: function parseError(str, hash){ throw new Error(str); }, parse: function parse(input){ var self=this, stack=[0], vstack=[null], lstack=[], table=this.table, yytext='', yylineno=0, yyleng=0, recovering=0, TERROR=2, EOF=1; this.lexer.setInput(input); this.lexer.yy=this.yy; this.yy.lexer=this.lexer; if(typeof this.lexer.yylloc=='undefined') this.lexer.yylloc={}; var yyloc=this.lexer.yylloc; lstack.push(yyloc); if(typeof this.yy.parseError==='function') this.parseError=this.yy.parseError; function popStack (n){ stack.length=stack.length - 2*n; vstack.length=vstack.length - n; lstack.length=lstack.length - n; } function lex(){ var token; token=self.lexer.lex()||1; if(typeof token!=='number'){ token=self.symbols_[token]||token; } return token; } var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected; while (true){ state=stack[stack.length-1]; if(this.defaultActions[state]){ action=this.defaultActions[state]; }else{ if(symbol==null) symbol=lex(); action=table[state]&&table[state][symbol]; } _handle_error: if(typeof action==='undefined'||!action.length||!action[0]){ if(!recovering){ expected=[]; for (p in table[state]) if(this.terminals_[p]&&p > 2){ expected.push("'"+this.terminals_[p]+"'"); } var errStr=''; if(this.lexer.showPosition){ errStr='Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'"; }else{ errStr='Parse error on line '+(yylineno+1)+": Unexpected " + (symbol==1 ? "end of input" : ("'"+(this.terminals_[symbol]||symbol)+"'")); } this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol]||symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); } if(recovering==3){ if(symbol==EOF){ throw new Error(errStr||'Parsing halted.'); } yyleng=this.lexer.yyleng; yytext=this.lexer.yytext; yylineno=this.lexer.yylineno; yyloc=this.lexer.yylloc; symbol=lex(); } while (1){ if((TERROR.toString()) in table[state]){ break; } if(state==0){ throw new Error(errStr||'Parsing halted.'); } popStack(1); state=stack[stack.length-1]; } preErrorSymbol=symbol; symbol=TERROR; state=stack[stack.length-1]; action=table[state]&&table[state][TERROR]; recovering=3; } if(action[0] instanceof Array&&action.length > 1){ throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol); } switch (action[0]){ case 1: stack.push(symbol); vstack.push(this.lexer.yytext); lstack.push(this.lexer.yylloc); stack.push(action[1]); symbol=null; if(!preErrorSymbol){ yyleng=this.lexer.yyleng; yytext=this.lexer.yytext; yylineno=this.lexer.yylineno; yyloc=this.lexer.yylloc; if(recovering > 0) recovering--; }else{ symbol=preErrorSymbol; preErrorSymbol=null; } break; case 2: len=this.productions_[action[1]][1]; yyval.$=vstack[vstack.length-len]; yyval._$={ first_line: lstack[lstack.length-(len||1)].first_line, last_line: lstack[lstack.length-1].last_line, first_column: lstack[lstack.length-(len||1)].first_column, last_column: lstack[lstack.length-1].last_column }; r=this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); if(typeof r!=='undefined'){ return r; } if(len){ stack=stack.slice(0,-1*len*2); vstack=vstack.slice(0, -1*len); lstack=lstack.slice(0, -1*len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState=table[stack[stack.length-2]][stack[stack.length-1]]; stack.push(newState); break; case 3: return true; }} return true; }}; var lexer=(function(){ var lexer=({EOF:1, parseError:function parseError(str, hash){ if(this.yy.parseError){ this.yy.parseError(str, hash); }else{ throw new Error(str); }}, setInput:function (input){ this._input=input; this._more=this._less=this.done=false; this.yylineno=this.yyleng=0; this.yytext=this.matched=this.match=''; this.conditionStack=['INITIAL']; this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0}; return this; }, input:function (){ var ch=this._input[0]; this.yytext+=ch; this.yyleng++; this.match+=ch; this.matched+=ch; var lines=ch.match(/\n/); if(lines) this.yylineno++; this._input=this._input.slice(1); return ch; }, unput:function (ch){ this._input=ch + this._input; return this; }, more:function (){ this._more=true; return this; }, pastInput:function (){ var past=this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, upcomingInput:function (){ var next=this.match; if(next.length < 20){ next +=this._input.substr(0, 20-next.length); } return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, ""); }, showPosition:function (){ var pre=this.pastInput(); var c=new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c+"^"; }, next:function (){ if(this.done){ return this.EOF; } if(!this._input) this.done=true; var token, match, col, lines; if(!this._more){ this.yytext=''; this.match=''; } var rules=this._currentRules(); for (var i=0;i < rules.length; i++){ match=this._input.match(this.rules[rules[i]]); if(match){ lines=match[0].match(/\n.*/g); if(lines) this.yylineno +=lines.length; this.yylloc={first_line: this.yylloc.last_line, last_line: this.yylineno+1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length-1].length-1:this.yylloc.last_column + match[0].length} this.yytext +=match[0]; this.match +=match[0]; this.matches=match; this.yyleng=this.yytext.length; this._more=false; this._input=this._input.slice(match[0].length); this.matched +=match[0]; token=this.performAction.call(this, this.yy, this, rules[i],this.conditionStack[this.conditionStack.length-1]); if(token) return token; else return; }} if(this._input===""){ return this.EOF; }else{ this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), {text: "", token: null, line: this.yylineno}); }}, lex:function lex(){ var r=this.next(); if(typeof r!=='undefined'){ return r; }else{ return this.lex(); }}, begin:function begin(condition){ this.conditionStack.push(condition); }, popState:function popState(){ return this.conditionStack.pop(); }, _currentRules:function _currentRules(){ return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules; }, topState:function (){ return this.conditionStack[this.conditionStack.length-2]; }, pushState:function begin(condition){ this.begin(condition); }}); lexer.performAction=function anonymous(yy,yy_,$avoiding_name_collisions,YY_START){ var YYSTATE=YY_START; switch($avoiding_name_collisions){ case 0: break; case 1:return 20 break; case 2:return 19 break; case 3:return 8 break; case 4:return 9 break; case 5:return 6 break; case 6:return 7 break; case 7:return 11 break; case 8:return 13 break; case 9:return 10 break; case 10:return 12 break; case 11:return 14 break; case 12:return 15 break; case 13:return 16 break; case 14:return 17 break; case 15:return 18 break; case 16:return 5 break; case 17:return 'INVALID' break; }}; lexer.rules=[/^\s+/,/^[0-9]+(\.[0-9]+)?\b/,/^n\b/,/^\|\|/,/^&&/,/^\?/,/^:/,/^<=/,/^>=/,/^/,/^!=/,/^==/,/^%/,/^\(/,/^\)/,/^$/,/^./]; lexer.conditions={"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],"inclusive":true}};return lexer;})() parser.lexer=lexer; return parser; })(); if(typeof exports!=='undefined'){ if(typeof module!=='undefined'&&module.exports){ exports=module.exports=Jed; } exports.Jed=Jed; }else{ if(typeof define==='function'&&define.amd){ define(function(){ return Jed; }); } root['Jed']=Jed; }})(this); (function($){ var Dokan_Vendor_Registration={ init: function(){ var form=$('form.register'); $('.user-role input[type=radio]', form).on('change', this.showSellerForm); $('.tc_check_box', form).on('click', this.onTOC); $('#shop-phone', form).keydown(this.ensurePhoneNumber); $('#company-name', form).on('focusout', this.generateSlugFromCompany); $('#seller-url', form).keydown(this.constrainSlug); $('#seller-url', form).keyup(this.renderUrl); $('#seller-url', form).on('focusout', this.checkSlugAvailability); this.validationLocalized(); }, validate: function(self){ $('form.register').validate({ errorPlacement: function(error, element){ var form_group=$(element).closest('.form-group'); form_group.addClass('has-error').append(error); }, success: function(label, element){ $(element).closest('.form-group').removeClass('has-error'); }, submitHandler: function(form){ form.submit(); }}); }, showSellerForm: function(){ var value=$(this).val(); if(value==='seller'){ $('.show_if_seller').find('input, select').removeAttr('disabled'); $('.show_if_seller').slideDown(); if($('.tc_check_box').length > 0){ $('button[name=register]').attr('disabled','disabled'); }}else{ $('.show_if_seller').find('input, select').attr('disabled', 'disabled'); $('.show_if_seller').slideUp(); if($('.tc_check_box').length > 0){ $('button[name=register]').removeAttr('disabled'); }} }, onTOC: function(){ var chk_value=$(this).val(); if($(this).prop("checked")){ $('input[name=register]').removeAttr('disabled'); $('button[name=register]').removeAttr('disabled'); $('input[name=dokan_migration]').removeAttr('disabled'); }else{ $('input[name=register]').attr('disabled', 'disabled'); $('button[name=register]').attr('disabled', 'disabled'); $('input[name=dokan_migration]').attr('disabled', 'disabled'); }}, ensurePhoneNumber: function(e){ if($.inArray(e.keyCode, [46, 8, 9, 27, 13, 91, 107, 109, 110, 187, 189, 190])!==-1 || (e.keyCode==65&&e.ctrlKey===true) || (e.keyCode >=35&&e.keyCode <=39)){ return; } if((e.shiftKey||(e.keyCode < 48||e.keyCode > 57))&&(e.keyCode < 96||e.keyCode > 105)){ e.preventDefault(); }}, generateSlugFromCompany: function(){ var value=getSlug($(this).val()); $('#seller-url').val(value); $('#url-alart').text(value); $('#seller-url').focus(); }, constrainSlug: function(e){ var text=$(this).val(); if($.inArray(e.keyCode, [46, 8, 9, 27, 13, 91, 109, 110, 173, 189, 190])!==-1 || (e.keyCode==65&&e.ctrlKey===true) || (e.keyCode >=35&&e.keyCode <=39)){ return; } if((e.shiftKey||(e.keyCode < 65||e.keyCode > 90)&&(e.keyCode < 48||e.keyCode > 57))&&(e.keyCode < 96||e.keyCode > 105)){ e.preventDefault(); }}, checkSlugAvailability: function(){ var self=$(this), data={ action:'shop_url', url_slug:self.val(), _nonce:dokan.nonce, }; if(self.val()===''){ return; } var row=self.closest('.form-row'); row.block({ message: null, overlayCSS: { background: '#fff url(' + dokan.ajax_loader + ') no-repeat center', opacity: 0.6 }}); $.post(dokan.ajaxurl, data, function(resp){ if(resp.success===true){ $('#url-alart').removeClass('text-danger').addClass('text-success'); $('#url-alart-mgs').removeClass('text-danger').addClass('text-success').text(dokan.seller.available); }else{ $('#url-alart').removeClass('text-success').addClass('text-danger'); $('#url-alart-mgs').removeClass('text-success').addClass('text-danger').text(dokan.seller.notAvailable); } row.unblock(); }); }, renderUrl: function(){ $('#url-alart').text($(this).val()); }, validationLocalized: function(){ var dokan_messages=DokanValidateMsg; dokan_messages.maxlength=$.validator.format(dokan_messages.maxlength_msg); dokan_messages.minlength=$.validator.format(dokan_messages.minlength_msg); dokan_messages.rangelength=$.validator.format(dokan_messages.rangelength_msg); dokan_messages.range=$.validator.format(dokan_messages.range_msg); dokan_messages.max=$.validator.format(dokan_messages.max_msg); dokan_messages.min=$.validator.format(dokan_messages.min_msg); $.validator.messages=dokan_messages; }}; $(function(){ Dokan_Vendor_Registration.init(); $('.show_if_seller').find('input, select').attr('disabled', 'disabled'); var shouldTrigger=$('.woocommerce ul').hasClass('woocommerce-error')&&! $('.show_if_seller').is(':hidden'); if(shouldTrigger){ var form=$('form.register'); $('.user-role input[type=radio]', form).trigger('change'); } if($('.tc_check_box').length > 0){ $('input[name=dokan_migration]').attr('disabled', 'disabled'); $('input[name=register]').attr('disabled', 'disabled'); }}); })(jQuery); !function(xe){var we=Math.abs,Se=Math.max,ze=Math.min,ke=Math.round;function Ce(){return xe("
    ")}xe.imgAreaSelect=function(o,n){var t,i,r,c,d,a,s,u,l,h,f,m,e,p,y,g,v,b,x,w,S,z,k,C,A,W,I,K=xe(o),P=Ce(),N=Ce(),H=Ce().add(Ce()).add(Ce()).add(Ce()),M=Ce().add(Ce()).add(Ce()).add(Ce()),E=xe([]),O={left:0,top:0},T={left:0,top:0},L=0,j="absolute",D={x1:0,y1:0,x2:0,y2:0,width:0,height:0},R=document.documentElement,X=navigator.userAgent;function Y(e){return e+O.left-T.left}function $(e){return e+O.top-T.top}function q(e){return e-O.left+T.left}function B(e){return e-O.top+T.top}function Q(e){return Se(e.pageX||0,G(e).x)-T.left}function F(e){return Se(e.pageY||0,G(e).y)-T.top}function G(e){e=e.originalEvent||{};return e.touches&&e.touches.length?{x:e.touches[0].pageX,y:e.touches[0].pageY}:{x:0,y:0}}function J(e){var t=e||h,e=e||f;return{x1:ke(D.x1*t),y1:ke(D.y1*e),x2:ke(D.x2*t),y2:ke(D.y2*e),width:ke(D.x2*t)-ke(D.x1*t),height:ke(D.y2*e)-ke(D.y1*e)}}function U(e,t,o,i,s){var n=s||h,s=s||f;(D={x1:ke(e/n||0),y1:ke(t/s||0),x2:ke(o/n||0),y2:ke(i/s||0)}).width=D.x2-D.x1,D.height=D.y2-D.y1}function V(){t&&K.width()&&(O={left:ke(K.offset().left),top:ke(K.offset().top)},d=K.innerWidth(),a=K.innerHeight(),O.top+=K.outerHeight()-a>>1,O.left+=K.outerWidth()-d>>1,e=ke(n.minWidth/h)||0,p=ke(n.minHeight/f)||0,y=ke(ze(n.maxWidth/h||1<<24,d)),g=ke(ze(n.maxHeight/f||1<<24,a)),"1.3.2"!=xe().jquery||"fixed"!=j||R.getBoundingClientRect||(O.top+=Se(document.body.scrollTop,R.scrollTop),O.left+=Se(document.body.scrollLeft,R.scrollLeft)),T=/absolute|relative/.test(s.css("position"))?{left:ke(s.offset().left)-s.scrollLeft(),top:ke(s.offset().top)-s.scrollTop()}:"fixed"==j?{left:xe(document).scrollLeft(),top:xe(document).scrollTop()}:{left:0,top:0},r=Y(0),c=$(0),(D.x2>d||D.y2>a)&&ne())}function Z(e){if(b){switch(P.css({left:Y(D.x1),top:$(D.y1)}).add(N).width(A=D.width).height(W=D.height),N.add(H).add(E).css({left:0,top:0}),H.width(Se(A-H.outerWidth()+H.innerWidth(),0)).height(Se(W-H.outerHeight()+H.innerHeight(),0)),xe(M[0]).css({left:r,top:c,width:D.x1,height:a}),xe(M[1]).css({left:r+D.x1,top:c,width:A,height:D.y1}),xe(M[2]).css({left:r+D.x2,top:c,width:d-D.x2,height:a}),xe(M[3]).css({left:r+D.x1,top:c+D.y2,width:A,height:a-D.y2}),A-=E.outerWidth(),W-=E.outerHeight(),E.length){case 8:xe(E[4]).css({left:A>>1}),xe(E[5]).css({left:A,top:W>>1}),xe(E[6]).css({left:A>>1,top:W}),xe(E[7]).css({top:W>>1});case 4:E.slice(1,3).css({left:A}),E.slice(2,4).css({top:W})}!1!==e&&(xe.imgAreaSelect.onKeyPress!=me&&xe(document).unbind(xe.imgAreaSelect.keyPress,xe.imgAreaSelect.onKeyPress),n.keys&&xe(document)[xe.imgAreaSelect.keyPress](xe.imgAreaSelect.onKeyPress=me)),ge&&H.outerWidth()-H.innerWidth()==2&&(H.css("margin",0),setTimeout(function(){H.css("margin","auto")},0))}}function _(e){V(),Z(e),x=Y(D.x1),w=$(D.y1),S=Y(D.x2),z=$(D.y2)}function ee(e,t){n.fadeSpeed?e.fadeOut(n.fadeSpeed,t):e.hide()}function te(e){var t=q(Q(e))-D.x1,e=B(F(e))-D.y1;I||(V(),I=!0,P.one("mouseout",function(){I=!1})),m="",n.resizable&&(e<=n.resizeMargin?m="n":e>=D.height-n.resizeMargin&&(m="s"),t<=n.resizeMargin?m+="w":t>=D.width-n.resizeMargin&&(m+="e")),P.css("cursor",m?m+"-resize":n.movable?"move":""),i&&i.toggle()}function oe(e){xe("body").css("cursor",""),!n.autoHide&&D.width*D.height!=0||ee(P.add(M),function(){xe(this).hide()}),xe(document).off("mousemove touchmove",re),P.on("mousemove touchmove",te),n.onSelectEnd(o,J())}function ie(e){return"mousedown"==e.type&&1!=e.which||(te(e),V(),m?(xe("body").css("cursor",m+"-resize"),x=Y(D[/w/.test(m)?"x2":"x1"]),w=$(D[/n/.test(m)?"y2":"y1"]),xe(document).on("mousemove touchmove",re).one("mouseup touchend",oe),P.off("mousemove touchmove",te)):n.movable?(u=r+D.x1-Q(e),l=c+D.y1-F(e),P.off("mousemove touchmove",te),xe(document).on("mousemove touchmove",de).one("mouseup touchend",function(){n.onSelectEnd(o,J()),xe(document).off("mousemove touchmove",de),P.on("mousemove touchmove",te)})):K.mousedown(e)),!1}function se(e){v&&(e?(S=Se(r,ze(r+d,x+we(z-w)*v*(xy&&(S=x-y*(Sg&&(z=w-g*(zthis.length?this.length:n)<0&&(n+=this.length+1);for(var s=[],r=[],o=[],h=[],a={},u=e.add,c=e.merge,l=e.remove,d=!1,f=this.comparator&&null==n&&!1!==e.sort,p=b.isString(this.comparator)?this.comparator:null,g=0;g 0){ this.addRandomChoice(current); }}, maybeRemoveOldCrop: function(model){ var newID=model.get('header').attachment_id||false, oldCrop; if(! newID){ return; } oldCrop=this.find(function(item){ return(item.cid!==model.cid&&item.get('header').attachment_id===newID); }); if(oldCrop){ this.remove(oldCrop); }}, maybeAddRandomChoice: function(){ if(this.size()===1){ this.addRandomChoice(); }}, addRandomChoice: function(initialChoice){ var isRandomSameType=RegExp(this.type).test(initialChoice), randomChoice='random-' + this.type + '-image'; this.add({ header: { timestamp: 0, random: randomChoice, width: 245, height: 41 }, choice: randomChoice, random: true, selected: isRandomSameType }); }, isRandomChoice: function(choice){ return (/^random-(uploaded|default)-image$/).test(choice); }, shouldHideTitle: function(){ return this.size() < 2; }, setImage: function(model){ this.each(function(m){ m.set('selected', false); }); if(model){ model.set('selected', true); }}, removeImage: function(){ this.each(function(m){ m.set('selected', false); }); }}); api.HeaderTool.DefaultsList=api.HeaderTool.ChoiceList.extend({ initialize: function(){ this.type='default'; this.data=_wpCustomizeHeader.defaults; api.HeaderTool.ChoiceList.prototype.initialize.apply(this); }}); })(jQuery, window.wp); jQuery(function($){ $('.tips').tooltip(); $('ul.order-status').on('click', 'a.dokan-edit-status', function(e){ $(this).addClass('dokan-hide').closest('li').next('li').removeClass('dokan-hide'); return false; }); $('ul.order-status').on('click', 'a.dokan-cancel-status', function(e){ $(this).closest('li').addClass('dokan-hide').prev('li').find('a.dokan-edit-status').removeClass('dokan-hide'); return false; }); $('form#dokan-order-status-form').on('submit', function(e){ e.preventDefault(); var self=$(this), li=self.closest('li'); li.block({ message: null, overlayCSS: { background: '#fff url(' + dokan.ajax_loader + ') no-repeat center', opacity: 0.6 }}); $.post(dokan.ajaxurl, self.serialize(), function(response){ li.unblock(); if(response.success){ var prev_li=li.prev(); li.addClass('dokan-hide'); prev_li.find('label').replaceWith(response.data); prev_li.find('a.dokan-edit-status').removeClass('dokan-hide'); }else{ alert(response.data); }}); }); $('form#add-order-note').on('submit', function(e){ e.preventDefault(); if(!$('textarea#add-note-content').val()) return; $('#dokan-order-notes').block({ message: null, overlayCSS: { background: '#fff url(' + dokan.ajax_loader + ') no-repeat center', opacity: 0.6 }}); $.post(dokan.ajaxurl, $(this).serialize(), function(response){ $('ul.order_notes').prepend(response); $('#dokan-order-notes').unblock(); $('#add-note-content').val(''); }); return false; }) $('#dokan-order-notes').on('click', 'a.delete_note', function(){ var note=$(this).closest('li.note'); $('#dokan-order-notes').block({ message: null, overlayCSS: { background: '#fff url(' + dokan.ajax_loader + ') no-repeat center', opacity: 0.6 }}); var data={ action: 'dokan_delete_order_note', note_id: $(note).attr('rel'), security: $('#delete-note-security').val() }; $.post(dokan.ajaxurl, data, function(response){ $(note).remove(); $('#dokan-order-notes').unblock(); }); return false; }); $('.order_download_permissions').on('click', 'button.grant_access', function(){ var self=$(this), product=$('select.grant_access_id').val(); if(!product) return; $('.order_download_permissions').block({ message: null, overlayCSS: { background: '#fff url(' + dokan.ajax_loader + ') no-repeat center', opacity: 0.6 }}); var data={ action: 'dokan_grant_access_to_download', product_ids: product, loop: $('.order_download_permissions .panel').size(), order_id: self.data('order-id'), security: self.data('nonce') }; $.post(dokan.ajaxurl, data, function(response){ if(response){ $('#accordion').append(response); }else{ alert('Could not grant access - the user may already have permission for this file or billing email is not set. Ensure the billing email is set, and the order has been saved.'); } $('.datepicker').datepicker(); $('.order_download_permissions').unblock(); }); return false; }); $('.order_download_permissions').on('click', 'button.revoke_access', function(e){ e.preventDefault(); var answer=confirm('Are you sure you want to revoke access to this download?'); if(answer){ var self=$(this), el=self.closest('.dokan-panel'); var product=self.attr('rel').split(",")[0]; var file=self.attr('rel').split(",")[1]; if(product > 0){ $(el).block({ message: null, overlayCSS: { background: '#fff url(' + dokan.ajax_loader + ') no-repeat center', opacity: 0.6 }}); var data={ action: 'dokan_revoke_access_to_download', product_id: product, download_id: file, order_id: self.data('order-id'), permission_id: self.data('permission-id'), security: self.data('nonce') }; $.post(dokan.ajaxurl, data, function(response){ $(el).fadeOut('300', function(){ $(el).remove(); }); }); }else{ $(el).fadeOut('300', function(){ $(el).remove(); }); }} return false; }); }); ;(function($){ var dokan_seller_meta_boxes_order_items={ init: function(){ let formatMap={ d: 'dd', D: 'D', j: 'd', l: 'DD', F: 'MM', m: 'mm', M: 'M', n: 'm', o: 'yy', Y: 'yy', y: 'y' } let i=0; let char=''; let datepickerFormat=''; for (i=0; i < dokan.i18n_date_format.length; i++){ char=dokan.i18n_date_format[i]; if(char in formatMap){ datepickerFormat +=formatMap[char]; }else{ datepickerFormat +=char; }} $("#shipped-date").datepicker({ dateFormat: datepickerFormat }); $('body').on('click','#dokan-add-tracking-number', this.showTrackingForm); $('body').on('click','#dokan-cancel-tracking-note', this.cancelTrackingForm); $('body').on('click','#add-tracking-details', this.insertShippingTrackingInfo); $('#woocommerce-order-items') .on('click', 'button.refund-items', this.refund_items) .on('click', '.cancel-action', this.cancel) .on('click', 'button.do-api-refund, button.do-manual-refund', this.refunds.do_refund) .on('change', '.refund input.refund_line_total, .refund input.refund_line_tax', this.refunds.input_changed) .on('change keyup', '.wc-order-refund-items #refund_amount', this.refunds.amount_changed) .on('change', 'input.refund_order_item_qty', this.refunds.refund_quantity_changed) .on('keyup', '.woocommerce_order_items .split-input input:eq(0)', function(){ var $subtotal=$(this).next(); if($subtotal.val()===''||$subtotal.is('.match-total')){ $subtotal.val($(this).val()).addClass('match-total'); }}) .on('keyup', '.woocommerce_order_items .split-input input:eq(1)', function(){ $(this).removeClass('match-total'); }) }, showTrackingForm: function(e){ e.preventDefault(); var self=$(this); self.closest('div').find('form#add-shipping-tracking-form').slideDown(300, function(){ $(this).removeClass('dokan-hide'); }); }, cancelTrackingForm: function(e){ e.preventDefault(); var self=$(this); self.closest('form#add-shipping-tracking-form').slideUp(300, function(){ $(this).addClass('dokan-hide'); }); }, insertShippingTrackingInfo: function(e){ e.preventDefault(); var shipping_tracking_info={ shipping_provider: $('#shipping_provider').val(), shipping_number: $('#tracking_number').val(), shipped_date: $('#shipped-date').val(), action: $('#action').val(), post_id: $('#post-id').val(), security: $('#security').val() }; $('#dokan-order-notes').block({ message: null, overlayCSS: { background: '#fff url(' + dokan.ajax_loader + ') no-repeat center', opacity: 0.6 }}); $.post(dokan.ajaxurl, shipping_tracking_info, function(response){ $('ul.order_notes').prepend(response); $('#dokan-order-notes').unblock(); $('form#add-shipping-tracking-form').find("input[type=text], textarea").val(""); }); return false; }, block: function(){ $('#woocommerce-order-items').block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 }}); }, unblock: function(){ $('#woocommerce-order-items').unblock(); }, reload_items: function(){ var data={ order_id: dokan_refund.post_id, action: 'dokan_load_order_items', security: dokan_refund.order_item_nonce }; dokan_seller_meta_boxes_order_items.block(); $.ajax({ url: dokan_refund.ajax_url, data: data, type: 'POST', success: function(response){ $('.dokan-panel-default #woocommerce-order-items').empty(); $('.dokan-panel-default #woocommerce-order-items').append(response); }}); }, refund_items: function(){ $('div.wc-order-refund-items').slideDown(); $('div.wc-order-bulk-actions').slideUp(); $('div.wc-order-totals-items').slideUp(); $('#woocommerce-order-items div.refund').show(); $('.wc-order-edit-line-item .wc-order-edit-line-item-actions').hide(); return false; }, cancel: function(){ $(this).closest('div.wc-order-data-row').slideUp(); $('div.wc-order-bulk-actions').slideDown(); $('div.wc-order-totals-items').slideDown(); $('#woocommerce-order-items div.refund').hide(); $('.wc-order-edit-line-item .wc-order-edit-line-item-actions').show(); if('true'===$(this).attr('data-reload')){ dokan_seller_meta_boxes_order_items.reload_items(); } return false; }, refunds: { do_refund: function(){ dokan_seller_meta_boxes_order_items.block(); if(window.confirm(dokan_refund.i18n_do_refund)){ var refund_amount=$('input#refund_amount').val(); var refund_reason=$('input#refund_reason').val(); var line_item_qtys={}; var line_item_totals={}; var line_item_tax_totals={}; $('.refund input.refund_order_item_qty').each(function(index, item){ if($(item).closest('tr').data('order_item_id')){ if(item.value){ line_item_qtys[ $(item).closest('tr').data('order_item_id') ]=item.value; }} }); $('.refund input.refund_line_total').each(function(index, item){ if($(item).closest('tr').data('order_item_id')){ line_item_totals[ $(item).closest('tr').data('order_item_id') ]=accounting.unformat(item.value, dokan_refund.mon_decimal_point); }}); $('.refund input.refund_line_tax').each(function(index, item){ if($(item).closest('tr').data('order_item_id')){ var tax_id=$(item).data('tax_id'); if(! line_item_tax_totals[ $(item).closest('tr').data('order_item_id') ]){ line_item_tax_totals[ $(item).closest('tr').data('order_item_id') ]={};} line_item_tax_totals[ $(item).closest('tr').data('order_item_id') ][ tax_id ]=accounting.unformat(item.value, dokan_refund.mon_decimal_point); }}); var data={ action: 'dokan_refund_request', order_id: dokan_refund.post_id, refund_amount: refund_amount, refund_reason: refund_reason, line_item_qtys: JSON.stringify(line_item_qtys, null, ''), line_item_totals: JSON.stringify(line_item_totals, null, ''), line_item_tax_totals: JSON.stringify(line_item_tax_totals, null, ''), api_refund: $(this).is('.do-api-refund'), restock_refunded_items: $('#restock_refunded_items:checked').size() ? 'true':'false', security: dokan_refund.order_item_nonce }; $.post(dokan_refund.ajax_url, data, function(response){ if(true===response.success){ window.alert(response.data); dokan_seller_meta_boxes_order_items.reload_items(); }else{ window.alert(response.data); dokan_seller_meta_boxes_order_items.unblock(); }}); }else{ dokan_seller_meta_boxes_order_items.unblock(); }}, input_changed: function(){ var refund_amount=0; var $items=$('.woocommerce_order_items').find('tr.item, tr.fee, tr.shipping'); $items.each(function(){ var $row=$(this); var refund_cost_fields=$row.find('.refund input:not(.refund_order_item_qty)'); refund_cost_fields.each(function(index, el){ refund_amount +=parseFloat(accounting.unformat($(el).val()||0, dokan_refund.mon_decimal_point)); }); }); $('#refund_amount') .val(accounting.formatNumber(refund_amount, dokan_refund.currency_format_num_decimals, '', dokan_refund.mon_decimal_point )) .change(); }, amount_changed: function(){ var total=accounting.unformat($(this).val(), dokan_refund.mon_decimal_point); $('button .wc-order-refund-amount .amount').text(accounting.formatMoney(total, { symbol: dokan_refund.currency_format_symbol, decimal: dokan_refund.currency_format_decimal_sep, thousand: dokan_refund.currency_format_thousand_sep, precision: dokan_refund.currency_format_num_decimals, format: dokan_refund.currency_format })); }, refund_quantity_changed: function(){ var $row=$(this).closest('tr.item'); var qty=$row.find('input.quantity').val(); var refund_qty=$(this).val(); var line_total=$('input.line_total', $row); var refund_line_total=$('input.refund_line_total', $row); var unit_total=accounting.unformat(line_total.attr('data-total'), dokan_refund.mon_decimal_point) / qty; refund_line_total.val(parseFloat(accounting.formatNumber(unit_total * refund_qty, dokan_refund.rounding_precision, '')) .toString() .replace('.', dokan_refund.mon_decimal_point) ).change(); $('td.line_tax', $row).each(function(){ var line_total_tax=$('input.line_tax', $(this)); var refund_line_total_tax=$('input.refund_line_tax', $(this)); var unit_total_tax=accounting.unformat(line_total_tax.attr('data-total_tax'), dokan_refund.mon_decimal_point) / qty; if(0 < unit_total_tax){ refund_line_total_tax.val(parseFloat(accounting.formatNumber(unit_total_tax * refund_qty, dokan_refund.rounding_precision, '')) .toString() .replace('.', dokan_refund.mon_decimal_point) ).change(); }else{ refund_line_total_tax.val(0).change(); }}); if(refund_qty > 0){ $('#restock_refunded_items').closest('tr').show(); }else{ $('#restock_refunded_items').closest('tr').hide(); $('.woocommerce_order_items input.refund_order_item_qty').each(function(){ if($(this).val() > 0){ $('#restock_refunded_items').closest('tr').show(); }}); } $(this).trigger('refund_quantity_changed'); }}, }; dokan_seller_meta_boxes_order_items.init(); $('#dokan-filter-customer').filter(':not(.enhanced)').each(function(){ var select2_args={ allowClear: $(this).data('allow_clear') ? true:false, placeholder: $(this).data('placeholder'), minimumInputLength: $(this).data('minimum_input_length') ? $(this).data('minimum_input_length'):'1', escapeMarkup: function(m){ return m; }, ajax: { url: dokan.ajaxurl, dataType: 'json', delay: 1000, data: function(params){ return { term: params.term, action: 'dokan_json_search_vendor_customers', security: dokan.search_customer_nonce, exclude: $(this).data('exclude') };}, processResults: function(data){ var terms=[]; if(data){ $.each(data, function(id, text){ terms.push({ id: id, text: text }); }); } return { results: terms };}, cache: true }}; $(this).select2(select2_args).addClass('enhanced'); if($(this).data('sortable')){ var $select=$(this); var $list=$(this).next('.select2-container').find('ul.select2-selection__rendered'); $list.sortable({ placeholder:'ui-state-highlight select2-selection__choice', forcePlaceholderSize: true, items:'li:not(.select2-search__field)', tolerance:'pointer', stop: function(){ $($list.find('.select2-selection__choice').get().reverse()).each(function(){ var id=$(this).data('data').id; var option=$select.find('option[value="' + id + '"]')[0]; $select.prepend(option); }); }}); }}); })(jQuery); ;(function($){ var variantsHolder=$('#variants-holder'); var product_gallery_frame; var product_featured_frame; var $image_gallery_ids=$('#product_image_gallery'); var $product_images=$('#product_images_container ul.product_images'); var Dokan_Editor={ init: function(){ product_type='simple'; $('.product-edit-container').on('click', '.dokan-section-heading', this.toggleProductSection); $('.product-edit-container').on('click', 'input[type=checkbox]#_downloadable', this.downloadable); $('.product-edit-container').on('click', 'a.sale-schedule', this.showDiscountSchedule); $('body, #dokan-product-images').on('click', 'a.add-product-images', this.gallery.addImages); $('body, #dokan-product-images').on('click', 'a.action-delete', this.gallery.deleteImage); this.gallery.sortable(); $('body, .product-edit-container').on('click', 'a.dokan-feat-image-btn', this.featuredImage.addImage); $('body, .product-edit-container').on('click', 'a.dokan-remove-feat-image', this.featuredImage.removeImage); $('body, #variable_product_options').on('click', '.sale_schedule', this.saleSchedule); $('body, #variable_product_options').on('click', '.cancel_sale_schedule', this.cancelSchedule); $('.product-edit-container').on('change', 'input[type=checkbox]#_manage_stock', this.showManageStock); $('.product-edit-container').on('click', 'a.upload_file_button', this.fileDownloadable); $('body').on('click', 'a.insert-file-row', function(){ $(this).closest('table').find('tbody').append($(this).data('row')); return false; }); $('body').on('click', 'a.dokan-product-delete', function(){ $(this).closest('tr').remove(); return false; }); $('body').on('submit', 'form.dokan-product-edit-form', this.inputValidate); $('.dokan-product-listing').on('click', 'a.dokan-add-new-product', this.addProductPopup); this.loadSelect2(); this.bindProductTagDropdown(); this.attribute.sortable(); this.checkProductPostboxToggle(); $('.product-edit-container .dokan-product-attribute-wrapper').on('click', 'a.dokan-product-toggle-attribute, .dokan-product-attribute-heading', this.attribute.toggleAttribute); $('.product-edit-container .dokan-product-attribute-wrapper').on('click', 'a.add_new_attribute', this.attribute.addNewAttribute); $('.product-edit-container .dokan-product-attribute-wrapper').on('keyup', 'input.dokan-product-attribute-name', this.attribute.dynamicAttrNameChange); $('.dokan-product-attribute-wrapper ul.dokan-attribute-option-list').on('click', 'button.dokan-select-all-attributes', this.attribute.selectAllAttr); $('.dokan-product-attribute-wrapper ul.dokan-attribute-option-list').on('click', 'button.dokan-select-no-attributes', this.attribute.selectNoneAttr); $('.dokan-product-attribute-wrapper ul.dokan-attribute-option-list').on('click', 'button.dokan-add-new-attribute', this.attribute.addNewExtraAttr); $('.product-edit-container .dokan-product-attribute-wrapper').on('click', 'a.dokan-product-remove-attribute', this.attribute.removeAttribute); $('.product-edit-container .dokan-product-attribute-wrapper').on('click', 'a.dokan-save-attribute', this.attribute.saveAttribute); $('body').on('click', '.product-container-footer input[type="submit"]', this.createNewProduct); this.attribute.disbalePredefinedAttribute(); $('body').trigger('dokan-product-editor-loaded', this); }, saleSchedule: function(){ var $wrap=$(this).closest('.dokan-product-field-content', 'div, table'); $(this).hide(); $wrap.find('.cancel_sale_schedule').show(); $wrap.find('.sale_price_dates_fields').show(); return false; }, cancelSchedule: function(){ var $wrap=$(this).closest('.dokan-product-field-content', 'div, table'); $(this).hide(); $wrap.find('.sale_schedule').show(); $wrap.find('.sale_price_dates_fields').hide(); $wrap.find('.sale_price_dates_fields').find('input').val(''); return false; }, checkProductPostboxToggle: function(){ var toggle=JSON.parse(localStorage.getItem('toggleClasses')); $.each(toggle, function(el, i){ var wrapper=$('.' + el.replace(/_/g, '-')), content=wrapper.find('.dokan-section-content'), targetIcon=wrapper.find('i.fa-sort-desc'); if(i){ content.show(); targetIcon.removeClass('fa-flip-horizointal').addClass('fa-flip-vertical'); targetIcon.css('marginTop', '9px'); }else{ content.hide(); targetIcon.removeClass('fa-flip-vertical').addClass('fa-flip-horizointal'); targetIcon.css('marginTop', '0px'); }}); }, toggleProductSection: function(e){ e.preventDefault(); var self=$(this); if(JSON.parse(localStorage.getItem('toggleClasses'))!=null){ var toggleClasses=JSON.parse(localStorage.getItem('toggleClasses')); }else{ var toggleClasses={};} self.closest('.dokan-edit-row').find('.dokan-section-content').slideToggle(300, function(){ if($(this).is(':visible')){ var targetIcon=self.find('i.fa-sort-desc'); targetIcon.removeClass('fa-flip-horizointal').addClass('fa-flip-vertical'); targetIcon.css('marginTop', '9px'); toggleClasses[self.data('togglehandler')]=true; }else{ var targetIcon=self.find('i.fa-sort-desc'); targetIcon.removeClass('fa-flip-vertical').addClass('fa-flip-horizointal'); targetIcon.css('marginTop', '0px'); toggleClasses[self.data('togglehandler')]=false; } localStorage.setItem('toggleClasses', JSON.stringify(toggleClasses)); }); }, loadSelect2: function(){ $('.dokan-select2').select2( { "language": { "noResults": function (){ return dokan.i18n_no_result_found; }} } ); }, bindProductTagDropdown: function (){ if(dokan.product_vendors_can_create_tags&&'on'===dokan.product_vendors_can_create_tags){ return; } $('#product_tag').select2({ language: { noResults: function (){ return dokan.i18n_no_result_found; }} }); }, addProductPopup: function (e){ e.preventDefault(); Dokan_Editor.openProductPopup(); }, openProductPopup: function(){ var productTemplate=wp.template('dokan-add-new-product'); $.magnificPopup.open({ fixedContentPos: true, items: { src: productTemplate().trim(), type: 'inline' }, callbacks: { open: function(){ $(this.content).closest('.mfp-wrap').removeAttr('tabindex'); Dokan_Editor.loadSelect2(); Dokan_Editor.bindProductTagDropdown(); $('.sale_price_dates_from, .sale_price_dates_to').on('focus', function(){ $(this).css('z-index', '99999'); }); $(".sale_price_dates_fields input").datepicker({ defaultDate: "", dateFormat: "yy-mm-dd", numberOfMonths: 1 }); $('.tips').tooltip(); Dokan_Editor.gallery.sortable(); $('body').trigger('dokan-product-editor-popup-opened', Dokan_Editor); }, close: function(){ product_gallery_frame=undefined; product_featured_frame=undefined; }} }); }, createNewProduct: function (e){ e.preventDefault(); var self=$(this), form=self.closest('form#dokan-add-new-product-form'), btn_id=self.attr('data-btn_id'); form.find('span.dokan-show-add-product-error').html(''); form.find('span.dokan-add-new-product-spinner').css('display', 'inline-block'); self.attr('disabled', 'disabled'); if(form.find('input[name="post_title"]').val()==''){ $('span.dokan-show-add-product-error').html(dokan.product_title_required); self.removeAttr('disabled'); form.find('span.dokan-add-new-product-spinner').css('display', 'none'); return; } if(form.find('select[name="product_cat"]').val()=='-1'){ $('span.dokan-show-add-product-error').html(dokan.product_category_required); self.removeAttr('disabled'); form.find('span.dokan-add-new-product-spinner').css('display', 'none'); return; } var data={ action: 'dokan_create_new_product', postdata: form.serialize(), _wpnonce:dokan.nonce }; $.post(dokan.ajaxurl, data, function(resp){ if(resp.success){ self.removeAttr('disabled'); if(btn_id=='create_new'){ $.magnificPopup.close(); window.location.href=resp.data; }else{ $('.dokan-dashboard-product-listing-wrapper').load(window.location.href + ' table.product-listing-table'); $.magnificPopup.close(); Dokan_Editor.openProductPopup(); }}else{ self.removeAttr('disabled'); $('span.dokan-show-add-product-error').html(resp.data); } form.find('span.dokan-add-new-product-spinner').css('display', 'none'); }); }, attribute: { toggleAttribute: function(e){ e.preventDefault(); var self=$(this), list=self.closest('li'), item=list.find('.dokan-product-attribute-item'); if($(item).hasClass('dokan-hide')){ self.closest('.dokan-product-attribute-heading').css({ borderBottom: '1px solid #e3e3e3' }); $(item).slideDown(200, function(){ self.find('i.fa').removeClass('fa-flip-horizointal').addClass('fa-flip-vertical'); $(this).removeClass('dokan-hide'); if(! $(e.target).hasClass('dokan-product-attribute-heading')){ $(e.target).closest('a').css('top', '12px'); }else if($(e.target).hasClass('dokan-product-attribute-heading')){ self.find('a.dokan-product-toggle-attribute').css('top', '12px'); }}); }else{ $(item).slideUp(200, function(){ $(this).addClass('dokan-hide'); self.find('i.fa').removeClass('fa-flip-vertical').addClass('fa-flip-horizointal'); if(! $(e.target).hasClass('dokan-product-attribute-heading')){ $(e.target).closest('a').css('top', '7px'); }else if($(e.target).hasClass('dokan-product-attribute-heading')){ self.find('a.dokan-product-toggle-attribute').css('top', '7px'); } self.closest('.dokan-product-attribute-heading').css({ borderBottom: 'none' }); }) } return false; }, sortable: function(){ $('.dokan-product-attribute-wrapper ul').sortable({ items: 'li.product-attribute-list', cursor: 'move', scrollSensitivity:40, forcePlaceholderSize: true, forceHelperSize: false, helper: 'clone', opacity: 0.65, placeholder: 'dokan-sortable-placeholder', start:function(event,ui){ ui.item.css('background-color','#f6f6f6'); }, stop:function(event,ui){ ui.item.removeAttr('style'); }, update: function(event, ui){ var attachment_ids=''; Dokan_Editor.attribute.reArrangeAttribute(); }}); }, dynamicAttrNameChange: function(e){ e.preventDefault(); var self=$(this), value=self.val(); if(value==''){ self.closest('li').find('strong').html('Attribute Name'); }else{ self.closest('li').find('strong').html(value); }}, selectAllAttr: function(e){ e.preventDefault(); $(this).closest('li.product-attribute-list').find('select.dokan_attribute_values option').attr('selected', 'selected'); $(this).closest('li.product-attribute-list').find('select.dokan_attribute_values').change(); return false; }, selectNoneAttr: function(e){ e.preventDefault(); $(this).closest('li.product-attribute-list').find('select.dokan_attribute_values option').removeAttr('selected'); $(this).closest('li.product-attribute-list').find('select.dokan_attribute_values').change(); return false; }, reArrangeAttribute: function(){ var attributeWrapper=$('.dokan-product-attribute-wrapper').find('ul.dokan-attribute-option-list'); attributeWrapper.find('li.product-attribute-list').css('cursor', 'default').each(function(i){ $(this).find('.attribute_position').val(i); }); }, addNewExtraAttr: function(e){ e.preventDefault(); var $wrapper=$(this).closest('li.product-attribute-list'); var attribute=$wrapper.data('taxonomy'); var new_attribute_name=window.prompt(dokan.new_attribute_prompt); if(new_attribute_name){ var data={ action: 'dokan_add_new_attribute', taxonomy: attribute, term: new_attribute_name, _wpnonce:dokan.nonce }; $.post(dokan.ajaxurl, data, function(response){ if(response.error){ window.alert(response.error); }else if(response.slug){ $wrapper.find('select.dokan_attribute_values').append(''); $wrapper.find('select.dokan_attribute_values').change(); }}); }}, addNewAttribute: function(e){ e.preventDefault(); var self=$(this), attrWrap=self.closest('.dokan-attribute-type').find('select#predefined_attribute'), attribute=attrWrap.val(), size=$('ul.dokan-attribute-option-list .product-attribute-list').length; var data={ action:'dokan_get_pre_attribute', taxonomy:attribute, i:size, _wpnonce:dokan.nonce }; self.closest('.dokan-attribute-type').find('span.dokan-attribute-spinner').removeClass('dokan-hide'); $.post(dokan.ajaxurl, data, function(resp){ if(resp.success){ var attributeWrapper=$('.dokan-product-attribute-wrapper').find('ul.dokan-attribute-option-list'); $html=$.parseHTML(resp.data); $($html).find('.dokan-product-attribute-item').removeClass('dokan-hide'); $($html).find('i.fa.fa-sort-desc').removeClass('fa-flip-horizointal').addClass('fa-flip-vertical'); $($html).find('a.dokan-product-toggle-attribute').css('top','12px'); $($html).find('.dokan-product-attribute-heading').css({ borderBottom: '1px solid #e3e3e3' }); attributeWrapper.append($html); $('select#product_type').trigger('change'); Dokan_Editor.loadSelect2(); Dokan_Editor.attribute.reArrangeAttribute(); }; self.closest('.dokan-attribute-type').find('span.dokan-attribute-spinner').addClass('dokan-hide'); if(attribute){ attrWrap.find('option[value="' + attribute + '"]').attr('disabled','disabled'); attrWrap.val(''); }}); }, removeAttribute: function(evt){ evt.stopPropagation(); if(window.confirm(dokan.remove_attribute)){ var $parent=$(this).closest('li.product-attribute-list'); $parent.fadeOut(300, function(){ if($parent.is('.taxonomy')){ $parent.find('select, input[type=text]').val(''); $('select.dokan_attribute_taxonomy').find('option[value="' + $parent.data('taxonomy') + '"]').removeAttr('disabled'); } Dokan_Editor.attribute.reArrangeAttribute(); }); } return false; }, saveAttribute: function(e){ e.preventDefault(); var self=$(this), data={ post_id: $('#dokan-edit-product-id').val(), data: $('ul.dokan-attribute-option-list').find('input, select, textarea').serialize(), action: 'dokan_save_attributes' }; $('.dokan-product-attribute-wrapper').block({ message: null, fadeIn: 50, fadeOut: 1000, overlayCSS: { background: '#fff', opacity: 0.6 }}); $.post(dokan.ajaxurl, data, function(resp){ $('#dokan-variable-product-options').load(window.location.toString() + ' #dokan-variable-product-options-inner', function(){ $('#dokan-variable-product-options').trigger('reload'); $('select#product_type').trigger('change'); $('.dokan-product-attribute-wrapper').unblock(); }); }); }, disbalePredefinedAttribute: function(){ $('ul.dokan-attribute-option-list li.product-attribute-list').each(function(index, el){ if($(el).css('display')!=='none'&&$(el).is('.taxonomy')){ $('select#predefined_attribute').find('option[value="' + $(el).data('taxonomy') + '"]').attr('disabled', 'disabled'); }}); }}, inputValidate: function(e){ e.preventDefault(); if($('#post_title').val().trim()==''){ $('#post_title').focus(); $('div.dokan-product-title-alert').removeClass('dokan-hide'); return; }else{ $('div.dokan-product-title-alert').hide(); } if($('select.product_cat').val()==-1){ $('select.product_cat').focus(); $('div.dokan-product-cat-alert').removeClass('dokan-hide'); return; }else{ $('div.dokan-product-cat-alert').hide(); } $('input[type=submit]').attr('disabled', 'disabled'); this.submit(); }, downloadable: function(){ if($(this).prop('checked')){ $(this).closest('aside').find('.dokan-side-body').removeClass('dokan-hide'); }else{ $(this).closest('aside').find('.dokan-side-body').addClass('dokan-hide'); }}, showDiscountSchedule: function(e){ e.preventDefault(); $('.sale-schedule-container').slideToggle('fast'); }, showManageStock: function(e){ if($(this).is(':checked')){ $('.show_if_stock').slideDown('fast'); }else{ $('.show_if_stock').slideUp('fast'); }}, gallery: { addImages: function(e){ e.preventDefault(); var self=$(this), p_images=self.closest('.dokan-product-gallery').find('#product_images_container ul.product_images'), images_gid=self.closest('.dokan-product-gallery').find('#product_image_gallery'); if(product_gallery_frame){ product_gallery_frame.open(); return; }else{ product_gallery_frame=wp.media({ title: dokan.i18n_choose_gallery, button: { text: dokan.i18n_choose_gallery_btn_text, }, multiple: true }); product_gallery_frame.on('select', function(){ var selection=product_gallery_frame.state().get('selection'); selection.map(function(attachment){ attachment=attachment.toJSON(); if(attachment.id){ attachment_ids=[]; $('
  • \ \ ×\
  • ').insertBefore(p_images.find('li.add-image')); $('#product_images_container ul li.image').css('cursor','default').each(function(){ var attachment_id=jQuery(this).attr('data-attachment_id'); attachment_ids.push(attachment_id); }); }}); images_gid.val(attachment_ids.join(',')); }); product_gallery_frame.open(); }}, deleteImage: function(e){ e.preventDefault(); var self=$(this), p_images=self.closest('.dokan-product-gallery').find('#product_images_container ul.product_images'), images_gid=self.closest('.dokan-product-gallery').find('#product_image_gallery'); self.closest('li.image').remove(); var attachment_ids=[]; $('#product_images_container ul li.image').css('cursor','default').each(function(){ var attachment_id=$(this).attr('data-attachment_id'); attachment_ids.push(attachment_id); }); images_gid.val(attachment_ids.join(',')); return false; }, sortable: function(){ $('body').find('#product_images_container ul.product_images').sortable({ items: 'li.image', cursor: 'move', scrollSensitivity:40, forcePlaceholderSize: true, forceHelperSize: false, helper: 'clone', opacity: 0.65, placeholder: 'dokan-sortable-placeholder', start:function(event,ui){ ui.item.css('background-color','#f6f6f6'); }, stop:function(event,ui){ ui.item.removeAttr('style'); }, update: function(event, ui){ var attachment_ids=[]; $('body').find('#product_images_container ul li.image').css('cursor','default').each(function(){ var attachment_id=jQuery(this).attr('data-attachment_id'); attachment_ids.push(attachment_id); }); $('body').find('#product_image_gallery').val(attachment_ids.join(',')); }}); }}, featuredImage: { addImage: function(e){ e.preventDefault(); var self=$(this); if(product_featured_frame){ product_featured_frame.open(); return; }else{ product_featured_frame=wp.media({ title: dokan.i18n_choose_featured_img, button: { text: dokan.i18n_choose_featured_img_btn_text, }}); product_featured_frame.on('select', function(){ var selection=product_featured_frame.state().get('selection'); selection.map(function(attachment){ attachment=attachment.toJSON(); self.siblings('input.dokan-feat-image-id').val(attachment.id); var instruction=self.closest('.instruction-inside'); var wrap=instruction.siblings('.image-wrap'); wrap.find('img').attr('src', attachment.url); wrap.find('img').removeAttr('srcset'); instruction.addClass('dokan-hide'); wrap.removeClass('dokan-hide'); }); }); product_featured_frame.open(); }}, removeImage: function(e){ e.preventDefault(); var self=$(this); var wrap=self.closest('.image-wrap'); var instruction=wrap.siblings('.instruction-inside'); instruction.find('input.dokan-feat-image-id').val('0'); wrap.addClass('dokan-hide'); instruction.removeClass('dokan-hide'); }}, fileDownloadable: function(e){ e.preventDefault(); var self=$(this), downloadable_frame; if(downloadable_frame){ downloadable_frame.open(); return; } downloadable_frame=wp.media({ title: dokan.i18n_choose_file, button: { text: dokan.i18n_choose_file_btn_text, }, multiple: true }); downloadable_frame.on('select', function(){ var selection=downloadable_frame.state().get('selection'); selection.map(function(attachment){ attachment=attachment.toJSON(); self.closest('tr').find('input.wc_file_url, input.wc_variation_file_url').val(attachment.url); }); }); downloadable_frame.on('ready', function(){ downloadable_frame.uploader.options.uploader.params={ type: 'downloadable_product' };}); downloadable_frame.open(); }}; $(function(){ Dokan_Editor.init(); $('select#product_type').change(function(){ var select_val=$(this).val(); if('variable'===select_val){ $('input#_manage_stock').change(); $('input#_downloadable').prop('checked', false); $('input#_virtual').removeAttr('checked'); } show_and_hide_panels(); $(document.body).trigger('dokan-product-type-change', select_val, $(this)); }).change(); $('.product-edit-container').on('change', 'input#_downloadable, input#_virtual', function(){ show_and_hide_panels(); }).change(); $('input#_downloadable').change(); $('input#_virtual').change(); function show_and_hide_panels(){ var product_type=$('#product_type').val(); var is_virtual=$('input#_virtual:checked').length; var is_downloadable=$('input#_downloadable:checked').length; var hide_classes='.hide_if_downloadable, .hide_if_virtual'; var show_classes='.show_if_downloadable, .show_if_virtual'; $.each(Object.keys(dokan.product_types), function(index, value){ hide_classes=hide_classes + ', .hide_if_' + value; show_classes=show_classes + ', .show_if_' + value; }); $(hide_classes).show(); $(show_classes).hide(); if(is_downloadable){ $('.show_if_downloadable').show(); } if(is_virtual){ $('.show_if_virtual').show(); } $('.show_if_' + product_type).show(); if(is_downloadable){ $('.hide_if_downloadable').hide(); } if(is_virtual){ $('.hide_if_virtual').hide(); } $('.hide_if_' + product_type).hide(); $('input#_manage_stock').change(); } $('.sale_price_dates_fields').each(function(){ var $these_sale_dates=$(this); var sale_schedule_set=false; var $wrap=$these_sale_dates.closest('div, table'); $these_sale_dates.find('input').each(function(){ if(''!==$(this).val()){ sale_schedule_set=true; }}); if(sale_schedule_set){ $wrap.find('.sale_schedule').hide(); $wrap.find('.sale_price_dates_fields').show(); }else{ $wrap.find('.sale_schedule').show(); $wrap.find('.sale_price_dates_fields').hide(); }}); $('.product-edit-container').on('click', '.sale_schedule', function(){ var $wrap=$(this).closest('.product-edit-container, div.dokan-product-variation-itmes, table'); $(this).hide(); $wrap.find('.cancel_sale_schedule').show(); $wrap.find('.sale_price_dates_fields').show(); return false; }); $('.product-edit-container').on('click', '.cancel_sale_schedule', function(){ var $wrap=$('.product-edit-container, div.dokan-product-variation-itmes, table'); $(this).hide(); $wrap.find('.sale_schedule').show(); $wrap.find('.sale_price_dates_fields').hide(); $wrap.find('.sale_price_dates_fields').find('input').val(''); return false; }); function dokan_show_earning_suggestion(callback){ let commission=$('span.vendor-earning').attr('data-commission'); let product_id=$('span.vendor-earning').attr('data-product-id'); let product_price=$('input.dokan-product-regular-price').val(); let sale_price=$('input.dokan-product-sales-price').val(); let earning_suggestion=$('.simple-product span.vendor-price'); earning_suggestion.html('Calculating'); $.get(dokan.ajaxurl, { action: 'get_vendor_earning', product_id: product_id, product_price: product_price, product_price: sale_price ? sale_price:product_price, _wpnonce: dokan.nonce }) .done(( response)=> { earning_suggestion.html(response); if(typeof callback==='function'){ callback(); }}); } $("input.dokan-product-regular-price, input.dokan-product-sales-price").on('keyup', _.debounce(()=> { dokan_show_earning_suggestion(function(){ if($('#product_type').val()=='simple'||$('#product_type').text()==''){ if(Number($('.simple-product span.vendor-price').text()) < 0){ $($('.dokan-product-less-price-alert').removeClass('dokan-hide')); $('input[type=submit]').attr('disabled', 'disabled'); $('button[type=submit]').attr('disabled', 'disabled'); }else{ $($('.dokan-product-less-price-alert').addClass('dokan-hide')); $('input[type=submit]').removeAttr('disabled'); $('button[type=submit]').removeAttr('disabled'); }} }); }, 750)); }); })(jQuery); jQuery(function($){ var api=wp.customize; $('.datepicker').datepicker({ dateFormat: 'yy-mm-dd' }); $('.tips').tooltip(); function showTooltip(x, y, contents){ jQuery('
    ' + contents + '
    ').css({ top: y - 16, left: x + 20 }).appendTo("body").fadeIn(200); } var prev_data_index=null; var prev_series_index=null; jQuery(".chart-placeholder").bind("plothover", function(event, pos, item){ if(item){ if(prev_data_index!=item.dataIndex||prev_series_index!=item.seriesIndex){ prev_data_index=item.dataIndex; prev_series_index=item.seriesIndex; jQuery(".chart-tooltip").remove(); if(item.series.points.show||item.series.enable_tooltip){ var y=item.series.data[item.dataIndex][1]; tooltip_content=''; if(item.series.prepend_label) tooltip_content=tooltip_content + item.series.label + ": "; if(item.series.prepend_tooltip) tooltip_content=tooltip_content + item.series.prepend_tooltip; tooltip_content=tooltip_content + y; if(item.series.append_tooltip) tooltip_content=tooltip_content + item.series.append_tooltip; if(item.series.pie.show){ showTooltip(pos.pageX, pos.pageY, tooltip_content); }else{ showTooltip(item.pageX, item.pageY, tooltip_content); }} }}else{ jQuery(".chart-tooltip").remove(); prev_data_index=null; }}); }); (function($){ $.validator.setDefaults({ ignore: ":hidden" }); var validatorError=function(error, element){ var form_group=$(element).closest('.dokan-form-group'); form_group.addClass('has-error').append(error); }; var validatorSuccess=function(label, element){ $(element).closest('.dokan-form-group').removeClass('has-error'); }; var api=wp.customize; var Dokan_Settings={ init: function(){ var self=this; $('a.dokan-banner-drag').on('click', this.imageUpload); $('a.dokan-remove-banner-image').on('click', this.removeBanner); $('a.dokan-pro-gravatar-drag').on('click', this.gragatarImageUpload); $('a.dokan-gravatar-drag').on('click', this.simpleImageUpload); $('a.dokan-remove-gravatar-image').on('click', this.removeGravatar); this.validateForm(self); return false; }, calculateImageSelectOptions: function(attachment, controller){ var xInit=parseInt(dokan.store_banner_dimension.width, 10), yInit=parseInt(dokan.store_banner_dimension.height, 10), flexWidth = !! parseInt(dokan.store_banner_dimension['flex-width'], 10), flexHeight = !! parseInt(dokan.store_banner_dimension['flex-height'], 10), ratio, xImg, yImg, realHeight, realWidth, imgSelectOptions; realWidth=attachment.get('width'); realHeight=attachment.get('height'); this.headerImage=new api.HeaderTool.ImageModel(); this.headerImage.set({ themeWidth: xInit, themeHeight: yInit, themeFlexWidth: flexWidth, themeFlexHeight: flexHeight, imageWidth: realWidth, imageHeight: realHeight }); controller.set('canSkipCrop', ! this.headerImage.shouldBeCropped()); ratio=xInit / yInit; xImg=realWidth; yImg=realHeight; if(xImg / yImg > ratio){ yInit=yImg; xInit=yInit * ratio; }else{ xInit=xImg; yInit=xInit / ratio; } imgSelectOptions={ handles: true, keys: true, instance: true, persistent: true, imageWidth: realWidth, imageHeight: realHeight, x1: 0, y1: 0, x2: xInit, y2: yInit }; if(flexHeight===false&&flexWidth===false){ imgSelectOptions.aspectRatio=xInit + ':' + yInit; } if(flexHeight===false){ imgSelectOptions.maxHeight=yInit; } if(flexWidth===false){ imgSelectOptions.maxWidth=xInit; } return imgSelectOptions; }, onSelect: function(){ this.frame.setState('cropper'); }, onCropped: function(croppedImage){ var url=croppedImage.url, attachmentId=croppedImage.attachment_id, w=croppedImage.width, h=croppedImage.height; this.setImageFromURL(url, attachmentId, w, h); }, onSkippedCrop: function(selection){ var url=selection.get('url'), w=selection.get('width'), h=selection.get('height'); this.setImageFromURL(url, selection.id, w, h); }, setImageFromURL: function(url, attachmentId, width, height){ if($(this.uploadBtn).hasClass('dokan-banner-drag')){ var wrap=$(this.uploadBtn).closest('.dokan-banner'); wrap.find('input.dokan-file-field').val(attachmentId); wrap.find('img.dokan-banner-img').attr('src', url); $(this.uploadBtn).parent().siblings('.image-wrap', wrap).removeClass('dokan-hide'); $(this.uploadBtn).parent('.button-area').addClass('dokan-hide'); }else if($(this.uploadBtn).hasClass('dokan-pro-gravatar-drag')){ var wrap=$(this.uploadBtn).closest('.dokan-gravatar'); wrap.find('input.dokan-file-field').val(attachmentId); wrap.find('img.dokan-gravatar-img').attr('src', url); $(this.uploadBtn).parent().siblings('.gravatar-wrap', wrap).removeClass('dokan-hide'); $(this.uploadBtn).parent('.gravatar-button-area').addClass('dokan-hide'); }}, removeImage: function(){ api.HeaderTool.currentHeader.trigger('hide'); api.HeaderTool.CombinedList.trigger('control:removeImage'); }, imageUpload: function(e){ e.preventDefault(); var file_frame, settings=Dokan_Settings; settings.uploadBtn=this; settings.frame=wp.media({ multiple: false, button: { text: dokan.selectAndCrop, close: false }, states: [ new wp.media.controller.Library({ title: dokan.chooseImage, library: wp.media.query({ type: 'image' }), multiple: false, date: false, priority: 20, suggestedWidth: dokan.store_banner_dimension.width, suggestedHeight: dokan.store_banner_dimension.height }), new wp.media.controller.Cropper({ suggestedWidth: 5000, imgSelectOptions: settings.calculateImageSelectOptions }) ] }); settings.frame.on('select', settings.onSelect, settings); settings.frame.on('cropped', settings.onCropped, settings); settings.frame.on('skippedcrop', settings.onSkippedCrop, settings); settings.frame.open(); }, calculateImageSelectOptionsProfile: function(attachment, controller){ var xInit=150, yInit=150, flexWidth = !! parseInt(dokan.store_banner_dimension['flex-width'], 10), flexHeight = !! parseInt(dokan.store_banner_dimension['flex-height'], 10), ratio, xImg, yImg, realHeight, realWidth, imgSelectOptions; realWidth=attachment.get('width'); realHeight=attachment.get('height'); this.headerImage=new api.HeaderTool.ImageModel(); this.headerImage.set({ themeWidth: xInit, themeHeight: yInit, themeFlexWidth: flexWidth, themeFlexHeight: flexHeight, imageWidth: realWidth, imageHeight: realHeight }); controller.set('canSkipCrop', ! this.headerImage.shouldBeCropped()); ratio=xInit / yInit; xImg=realWidth; yImg=realHeight; if(xImg / yImg > ratio){ yInit=yImg; xInit=yInit * ratio; }else{ xInit=xImg; yInit=xInit / ratio; } imgSelectOptions={ handles: true, keys: true, instance: true, persistent: true, imageWidth: realWidth, imageHeight: realHeight, x1: 0, y1: 0, x2: xInit, y2: yInit }; if(flexHeight===false&&flexWidth===false){ imgSelectOptions.aspectRatio=xInit + ':' + yInit; } if(flexHeight===false){ imgSelectOptions.maxHeight=yInit; } if(flexWidth===false){ imgSelectOptions.maxWidth=xInit; } return imgSelectOptions; }, simpleImageUpload:function(e){ e.preventDefault(); var file_frame, self=$(this); if(file_frame){ file_frame.open(); return; } file_frame=wp.media.frames.file_frame=wp.media({ title: jQuery(this).data('uploader_title'), button: { text: jQuery(this).data('uploader_button_text') }, multiple: false }); file_frame.on('select', function(){ var attachment=file_frame.state().get('selection').first().toJSON(); var wrap=self.closest('.dokan-gravatar'); wrap.find('input.dokan-file-field').val(attachment.id); wrap.find('img.dokan-gravatar-img').attr('src', attachment.url); self.parent().siblings('.gravatar-wrap', wrap).removeClass('dokan-hide'); self.parent('.gravatar-button-area').addClass('dokan-hide'); }); file_frame.open(); }, gragatarImageUpload: function(e){ e.preventDefault(); var file_frame, settings=Dokan_Settings; settings.uploadBtn=this; settings.frame=wp.media({ multiple: false, button: { text: dokan.selectAndCrop, close: false }, states: [ new wp.media.controller.Library({ title: dokan.chooseImage, library: wp.media.query({ type: 'image' }), multiple: false, date: false, priority: 20, suggestedWidth: 150, suggestedHeight: 150 }), new wp.media.controller.Cropper({ imgSelectOptions: settings.calculateImageSelectOptionsProfile }) ] }); settings.frame.on('select', settings.onSelect, settings); settings.frame.on('cropped', settings.onCropped, settings); settings.frame.on('skippedcrop', settings.onSkippedCrop, settings); settings.frame.open(); }, submitSettings: function(form_id){ if(typeof tinyMCE!='undefined'){ tinyMCE.triggerSave(); } var self=$("form#" + form_id), form_data=self.serialize() + '&action=dokan_settings&form_id=' + form_id; self.find('.ajax_prev').append(' '); $.post(dokan.ajaxurl, form_data, function(resp){ self.find('span.dokan-loading').remove(); $('html,body').animate({scrollTop:100}); if(resp.success){ $('.dokan-ajax-response').html($('
    ', { 'class': 'dokan-alert dokan-alert-success', 'html': '

    ' + resp.data.msg + '

    ', })); $('.dokan-ajax-response').append(resp.data.progress); }else{ $('.dokan-ajax-response').html($('
    ', { 'class': 'dokan-alert dokan-alert-danger', 'html': '

    ' + resp.data + '

    ' })); }}); }, validateForm: function(self){ $("form#settings-form, form#profile-form, form#store-form, form#payment-form").validate({ submitHandler: function(form){ self.submitSettings(form.getAttribute('id')); }, errorElement: 'span', errorClass: 'error', errorPlacement: validatorError, success: validatorSuccess, ignore: '.select2-search__field, :hidden, .mapboxgl-ctrl-geocoder--input' }); }, removeBanner: function(e){ e.preventDefault(); var self=$(this); var wrap=self.closest('.image-wrap'); var instruction=wrap.siblings('.button-area'); wrap.find('input.dokan-file-field').val('0'); wrap.addClass('dokan-hide'); instruction.removeClass('dokan-hide'); }, removeGravatar: function(e){ e.preventDefault(); var self=$(this); var wrap=self.closest('.gravatar-wrap'); var instruction=wrap.siblings('.gravatar-button-area'); wrap.find('input.dokan-file-field').val('0'); wrap.addClass('dokan-hide'); instruction.removeClass('dokan-hide'); }, }; var Dokan_Withdraw={ init: function(){ var self=this; this.withdrawValidate(self); }, withdrawValidate: function(self){ $('form.withdraw').validate({ errorElement: 'span', errorClass: 'error', errorPlacement: validatorError, success: validatorSuccess }) }}; var Dokan_Seller={ init: function(){ this.validate(this); }, validate: function(self){ $('form#dokan-form-contact-seller').validate({ errorPlacement: validatorError, success: validatorSuccess, submitHandler: function(form){ $(form).block({ message: null, overlayCSS: { background: '#fff url(' + dokan.ajax_loader + ') no-repeat center', opacity: 0.6 }}); var form_data=$(form).serialize(); $.post(dokan.ajaxurl, form_data, function(resp){ $(form).unblock(); if(typeof resp.data!=='undefined'){ $(form).find('.ajax-response').html(resp.data); } $(form).find('input[type=text], input[type=email], textarea').val('').removeClass('valid'); }); }}); }}; $(function(){ Dokan_Settings.init(); Dokan_Withdraw.init(); Dokan_Seller.init(); $('.dokan-form-horizontal').on('change', 'input[type=checkbox]#lbl_setting_minimum_quantity', function(){ var showSWDiscount=$('.show_if_needs_sw_discount'); if($(this).is(':checked')){ showSWDiscount.find('input[type="number"]').val(''); showSWDiscount.slideDown('slow'); }else{ showSWDiscount.slideUp('slow'); }}); }); })(jQuery); (function($){ var dokan_messages=DokanValidateMsg; dokan_messages.maxlength=$.validator.format(dokan_messages.maxlength_msg); dokan_messages.minlength=$.validator.format(dokan_messages.minlength_msg); dokan_messages.rangelength=$.validator.format(dokan_messages.rangelength_msg); dokan_messages.range=$.validator.format(dokan_messages.range_msg); dokan_messages.max=$.validator.format(dokan_messages.max_msg); dokan_messages.min=$.validator.format(dokan_messages.min_msg); $.validator.messages=dokan_messages; $(document).on('click','#dokan_store_tnc_enable',function(e){ if($(this).is(':checked')){ $('#dokan_tnc_text').show(); }else{ $('#dokan_tnc_text').hide(); }}).ready(function(e){ if($('#dokan_store_tnc_enable').is(':checked')){ $('#dokan_tnc_text').show(); }else{ $('#dokan_tnc_text').hide(); }}); })(jQuery); ;(function($){ function resize_dummy_image(){ var width=dokan.store_banner_dimension.width, height=(dokan.store_banner_dimension.height / dokan.store_banner_dimension.width) * $('#dokan-content').width(); $('.profile-info-img.dummy-image').css({ height: height }); } resize_dummy_image(); $(window).on('resize', function (e){ resize_dummy_image(); }); $(':input.dokan-product-search').filter(':not(.enhanced)').each(function(){ var select2_args={ allowClear: $(this).data('allow_clear') ? true:false, placeholder: $(this).data('placeholder'), minimumInputLength: $(this).data('minimum_input_length') ? $(this).data('minimum_input_length'):'3', escapeMarkup: function(m){ return m; }, language: { errorLoading: function(){ return dokan.i18n_searching; }, inputTooLong: function(args){ var overChars=args.input.length - args.maximum; if(1===overChars){ return dokan.i18n_input_too_long_1; } return dokan.i18n_input_too_long_n.replace('%qty%', overChars); }, inputTooShort: function(args){ var remainingChars=args.minimum - args.input.length; if(1===remainingChars){ return dokan.i18n_input_too_short_1; } return dokan.i18n_input_too_short_n.replace('%qty%', remainingChars); }, loadingMore: function(){ return dokan.i18n_load_more; }, maximumSelected: function(args){ if(args.maximum===1){ return dokan.i18n_selection_too_long_1; } return dokan.i18n_selection_too_long_n.replace('%qty%', args.maximum); }, noResults: function(){ return dokan.i18n_no_matches; }, searching: function(){ return dokan.i18n_searching; }}, ajax: { url: dokan.ajaxurl, dataType: 'json', delay: 250, data: function(params){ return { term: params.term, action: $(this).data('action')||'dokan_json_search_products_and_variations', security: dokan.search_products_nonce, exclude: $(this).data('exclude'), user_ids: $(this).data('user_ids'), include: $(this).data('include'), limit: $(this).data('limit') };}, processResults: function(data){ var terms=[]; if(data){ $.each(data, function(id, text){ terms.push({ id: id, text: text }); }); } return { results: terms };}, cache: true }}; $(this).select2(select2_args).addClass('enhanced'); if($(this).data('sortable')){ var $select=$(this); var $list=$(this).next('.select2-container').find('ul.select2-selection__rendered'); $list.sortable({ placeholder:'ui-state-highlight select2-selection__choice', forcePlaceholderSize: true, items:'li:not(.select2-search__field)', tolerance:'pointer', stop: function(){ $($list.find('.select2-selection__choice').get().reverse()).each(function(){ var id=$(this).data('data').id; var option=$select.find('option[value="' + id + '"]')[0]; $select.prepend(option); }); }}); }}); var bulkItemsSelection={ init: function(){ selected_items=[]; $('#cb-select-all').on('change', function(e){ var self=$(this); var item_id=$('.cb-select-items'); if(self.is(':checked')){ item_id.each(function(key, value){ var item=$(value); item.prop('checked', 'checked'); }); }else{ item_id.each(function(key, value){ $(value).prop('checked', ''); selected_items.pop(); }); }}); }}; bulkItemsSelection.init(); })(jQuery); ;(function($){ var storeLists={ query: {}, form: null, cateItemStringArray: [], init: function(){ $('#dokan-store-listing-filter-wrap .sort-by #stores_orderby').on('change', this.buildSortByQuery); $('#dokan-store-listing-filter-wrap .toggle-view span').on('click', this.toggleView); $('#dokan-store-listing-filter-wrap .dokan-store-list-filter-button, #dokan-store-listing-filter-wrap .dokan-icons, #dokan-store-listing-filter-form-wrap .apply-filter #cancel-filter-btn ').on('click', this.toggleForm); $('#dokan-store-listing-filter-form-wrap .store-search-input').on('change', this.buildSearchQuery); $('#dokan-store-listing-filter-form-wrap .apply-filter #apply-filter-btn').on('click', this.submitForm); this.maybeHideListView(); const self=storeLists; self.form=document.forms.dokan_store_lists_filter_form; const view=self.getLocal('dokan-layout'); if(view){ const toggleBtns=$('.toggle-view span'); self.setView(view, toggleBtns); } const params=self.getParams(); if(params.length){ let openTheForm=false; params.forEach(function(param){ const keys=Object.keys(param); const values=Object.values(param); if(! keys.includes('stores_orderby')||params.length > 1){ openTheForm=true; } self.setParams(keys, values); }); if(openTheForm){ $('#dokan-store-listing-filter-form-wrap').slideToggle(); }} }, buildSortByQuery: function(event){ const self=storeLists; self.query.stores_orderby=event.target.value; self.submitForm(event); }, toggleView: function(event){ const self=storeLists; const currentElement=$(event.target); const elements=currentElement.parent().find('span'); const view=currentElement.data('view'); self.setView(view, elements); self.setLocal('dokan-layout', view); }, setView: function(view, elements){ if(typeof view==='undefined' || view.length < 1 || typeof elements==='undefined' || elements.length < 1 ){ return; } const listingWrap=$('#dokan-seller-listing-wrap'); [...elements].forEach(function(value){ const element=$(value); if(view===element.data('view')){ element.addClass('active'); listingWrap.addClass(view); }else{ element.removeClass('active'); listingWrap.removeClass(element.data('view')); }}); }, toggleForm: function(event){ event.preventDefault(); $('#dokan-store-listing-filter-form-wrap').slideToggle(); }, buildSearchQuery: function(event){ if(event.target.value){ storeLists.query.dokan_seller_search=event.target.value; }else{ delete storeLists.query.dokan_seller_search; }}, submitForm: function(event){ event.preventDefault(); const queryString=decodeURIComponent($.param(storeLists.query)); window.history.pushState(null, null, `?${queryString}`); window.location.reload(); }, setLocal: function(key, value){ window.localStorage.setItem(key, value); }, getLocal: function(key){ return window.localStorage.getItem(key); }, setParams: function(key, value){ const self=storeLists; const elements=self.form ? self.form.elements:''; const sortingForm=document.forms.stores_sorting; const sortingFormElements=sortingForm ? sortingForm.elements:''; Object.values(sortingFormElements).forEach(function(element){ if(element.name===key[0]){ $(element).val(value[0]); }}); Object.values(elements).forEach(function(element){ if(key.includes(element.name)){ if(element.type==='checkbox'){ element.checked=['yes', 'true', '1'].includes(value[0]) ? true:false; }else if([ 'text', 'search' ].includes(element.type)){ element.value=value[0]; }} if(key[0]==='store_category[]'&&key[0].includes('[')){ const trimedValue=value[0].split(' ').join('-'); const cateItem=$(`[data-slug=${trimedValue}]`); if(! self.cateItemStringArray.includes(cateItem.text().trim())){ self.cateItemStringArray.push(cateItem.text().trim()); } cateItem.addClass('dokan-btn-theme'); }else if(key[0]==='rating'){ const trimedValue=value[0].split(' ').join('-'); $(`[data-${key[0]}=${trimedValue}]`).addClass('active'); $(`[data-rating=${trimedValue}]`).parent().addClass('selected'); }}); key.forEach(function(param, index){ if(! param.includes('[')){ self.query[ param ]=value[ index ]; }}); }, getParams: function(){ const params=new URLSearchParams(location.search); const allParams=[]; params.forEach(function(value, key){ allParams.push({ [key]: value }); }); return allParams; }, maybeHideListView: function(){ const self=storeLists; if(window.matchMedia('(max-width: 767px)').matches){ if('list-view'===self.getLocal('dokan-layout')){ self.setLocal('dokan-layout', 'grid-view'); }} $(window).on('resize', function(){ const container=$(this); if(container.width() < 767){ $('#dokan-seller-listing-wrap').removeClass('list-view'); $('#dokan-seller-listing-wrap').addClass('grid-view'); }else{ $('.toggle-view.item span').last().removeClass('active'); $('.toggle-view.item span').first().addClass('active'); }}); }}; if(window.dokan){ window.dokan.storeLists=storeLists; window.dokan.storeLists.init(); }})(jQuery); !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;hc;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('
      ');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('
    • '),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html(''),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('
        '),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('
      • ×
      • ');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e0||0===c.length)){var d=a('×');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change"); if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()&&e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('
      • '),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a(""),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.topf.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null; },e.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("select2/compat/utils",["jquery"],function(a){function b(b,c,d){var e,f,g=[];e=a.trim(b.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0===this.indexOf("select2-")&&g.push(this)})),e=a.trim(c.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0!==this.indexOf("select2-")&&(f=d(this),null!=f&&g.push(f))})),b.attr("class",g.join(" "))}return{syncCssClasses:b}}),b.define("select2/compat/containerCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("containerCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptContainerCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("containerCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/dropdownCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("dropdownCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptDropdownCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("dropdownCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/initSelection",["jquery"],function(a){function b(a,b,c){c.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `initSelection` option has been deprecated in favor of a custom data adapter that overrides the `current` method. This method is now called multiple times instead of a single time when the instance is initialized. Support will be removed for the `initSelection` option in future versions of Select2"),this.initSelection=c.get("initSelection"),this._isInitialized=!1,a.call(this,b,c)}return b.prototype.current=function(b,c){var d=this;return this._isInitialized?void b.call(this,c):void this.initSelection.call(null,this.$element,function(b){d._isInitialized=!0,a.isArray(b)||(b=[b]),c(b)})},b}),b.define("select2/compat/inputData",["jquery"],function(a){function b(a,b,c){this._currentData=[],this._valueSeparator=c.get("valueSeparator")||",","hidden"===b.prop("type")&&c.get("debug")&&console&&console.warn&&console.warn("Select2: Using a hidden input with Select2 is no longer supported and may stop working in the future. It is recommended to use a `'); } $('#dokan_address_state').val('N/A'); }else{ input_selected_state=''; var options='', state=states[ country ]; for(var index in state){ if(state.hasOwnProperty(index)){ if(selected_state){ if(selected_state==index){ var selected_value='selected="selected"'; }else{ var selected_value=''; }} options=options + ''; }} if($statebox.is('select')){ $('select#dokan_address_state').html('' + options); } if($statebox.is('input')){ $('input#dokan_address_state').replaceWith(''); $('select#dokan_address_state').html('' + options); } $('#dokan_address_state').removeClass('dokan-hide'); $('div#dokan-states-box').slideDown(); }}else{ if($statebox.is('select')){ input_selected_state=''; $('select#dokan_address_state').replaceWith(''); } $('#dokan_address_state').val(input_selected_state); if($('#dokan_address_state').val()=='N/A'){ $('#dokan_address_state').val(''); } $('#dokan_address_state').removeClass('dokan-hide'); $('div#dokan-states-box').slideDown(); }} } $(document).ready(function (){ dokan_address_select.init(); $('button#dokan_v_id_click').click(function (){ $(this).slideUp('fast',function(){ $('.dokan_v_id_info_box').slideDown('fast'); }); }); $('input#dokan_v_id_cancel_form').click(function (){ $('.dokan_v_id_info_box').slideUp('fast',function(){ $('button#dokan_v_id_click').slideDown('fast'); }); }); $('.dokan-verification-content').on('click', 'input#dokan_v_id_submit', function(e){ e.preventDefault(); if($("input[name='dokan_gravatar']").val()==0){ alert('Upload a Photo'); return; } var self=$(this), data={ action: 'dokan_update_verify_info', data: self.closest('#dokan-verify-id-form').serialize(), }; feedback.fadeOut(); $.post(dokan.ajaxurl, data, function(resp){ if(resp.success==true){ $('#dokan_v_id_feedback').addClass('hidden'); feedback.addClass('dokan-alert dokan-alert-success'); feedback.html(resp.data); feedback.fadeIn(); $('div.dokan_v_id_info_box').hide(); $('button#dokan_v_id_cancel').show(); }else{ feedback.addClass('dokan-alert dokan-alert-danger'); feedback.html('failed'); feedback.fadeIn(); }}) }); $('button#dokan_v_id_cancel').click(function (){ data={ action: 'dokan_id_verification_cancel', data: 'cancel', }; feedback.fadeOut(); $.post(dokan.ajaxurl, data, function(resp){ if(resp.success==true){ $('#dokan_v_id_feedback').addClass('hidden'); feedback.addClass('dokan-alert dokan-alert-success'); feedback.html(resp.data); feedback.fadeIn(); $('button#dokan_v_id_cancel').hide(); $('button#dokan_v_id_click').removeClass('dokan-hide'); $('button#dokan_v_id_click').show(); }else{ feedback.addClass('dokan-alert dokan-alert-danger'); feedback.html('failed'); feedback.fadeIn(); }}) }); $('.dokan_v_phone_box').on('submit', 'form#dokan-verify-phone-form', function(e){ e.preventDefault(); if($("input[name='phone']").val()==''){ alert('Insert Phone No.'); return; } var self=$(this), data={ action:'dokan_v_send_sms', data:self.serialize(), }; $.post(dokan.ajaxurl, data, function(resp){ if(resp.success==true){ if(resp.data.success==true){ phoneFeedback.removeClass(); phoneFeedback.addClass('dokan-alert dokan-alert-success'); phoneFeedback.html(resp.data.message); $('div.dokan_v_phone_box').slideUp(); $('div.dokan_v_phone_code_box').slideDown(); }else{ phoneFeedback.removeClass(); phoneFeedback.addClass('dokan-alert dokan-alert-danger'); phoneFeedback.html(resp.data.message); }}else{ $('#feedback').addClass('dokan-alert dokan-alert-danger'); $('#feedback').html('failed'); }}) }); $('#phone').keydown(function(e){ if($.inArray(e.keyCode, [ 46, 8, 9, 27, 13, 91, 107, 109, 110, 187, 189, 190 ])!==-1 || (e.keyCode==65&&e.ctrlKey===true) || (e.keyCode >=35&&e.keyCode <=39)){ return; } if(( e.shiftKey||(e.keyCode < 48||e.keyCode > 57))&&(e.keyCode < 96||e.keyCode > 105)){ e.preventDefault(); }}); $('.dokan_v_phone_code_box').on('submit', 'form#dokan-v-phone-code-form', function(e){ e.preventDefault(); if($("input[name='sms_code']").val()==''){ alert('Insert SMS code'); return; } var self=$(this), data={ action:'dokan_v_verify_sms_code', data:self.serialize(), }; $.post(dokan.ajaxurl, data, function(resp){ if(resp.success==true){ if(resp.data.success==true){ phoneFeedback.removeClass(); phoneFeedback.addClass('dokan-alert dokan-alert-success'); phoneFeedback.html(resp.data.message); $('.dokan_v_phone_code_box').fadeOut(); }else{ phoneFeedback.removeClass(); phoneFeedback.addClass('dokan-alert dokan-alert-danger'); phoneFeedback.html(resp.data.message); }}else{ $('#feedback').addClass('dokan-alert dokan-alert-danger'); $('#feedback').html('failed'); }}); }); $('button#dokan_v_address_click').click(function (){ $('button#dokan_v_address_click').slideUp('fast',function(){ $('.dokan_v_address_box').slideDown('fast'); }); }); $('input#dokan_v_address_cancel').click(function (){ $('.dokan_v_address_box').slideUp('fast',function(){ $('button#dokan_v_address_click').slideDown('fast'); var address_feedback=$('div#d_v_address_feedback'); address_feedback.addClass('dokan-hide'); address_feedback.html(''); }); }); $('.dokan-verification-content').on('submit', 'form#dokan-verify-address-form', function(e){ e.preventDefault(); var self=$(this); var address_feedback=$('div#d_v_address_feedback'); feedback.fadeOut(); address_feedback.addClass('dokan-hide'); $.post(dokan.ajaxurl, self.serialize(), function(resp){ if(resp.success==true){ feedback.addClass('dokan-alert dokan-alert-success'); $('html,body').animate({ scrollTop: 100 }); feedback.html(resp.data); feedback.fadeIn(); $('div.dokan_v_address_box').slideUp('fast'); $('button#dokan_v_address_cancel').removeClass('dokan-hide'); $('#dokan_v_address_cancel').show(); }else{ address_feedback.addClass('dokan-alert dokan-alert-danger'); address_feedback.html(resp.data); address_feedback.removeClass('dokan-hide'); address_feedback.fadeIn(); }}); }); $('button#dokan_v_address_cancel').click(function (){ var data={ action: 'dokan_address_verification_cancel', data: 'cancel', }; feedback.fadeOut(); $.post(dokan.ajaxurl, data, function(resp){ if(resp.success==true){ $('#dokan_v_address_feedback').addClass('dokan-hide'); feedback.addClass('dokan-alert dokan-alert-success'); feedback.html(resp.data); feedback.fadeIn(); $('button#dokan_v_address_cancel').addClass('dokan-hide'); $('button#dokan_v_address_click').removeClass('dokan-hide'); $('button#dokan_v_address_click').show(); $('div#d_v_address_feedback').addClass('dokan-hide'); }else{ feedback.addClass('dokan-alert dokan-alert-danger'); feedback.html('failed'); feedback.fadeIn(); }}) }); }); })(jQuery); !function(c,d){"use strict";var e=!1,n=!1;if(d.querySelector)if(c.addEventListener)e=!0;if(c.wp=c.wp||{},!c.wp.receiveEmbedMessage)if(c.wp.receiveEmbedMessage=function(e){var t=e.data;if(t)if(t.secret||t.message||t.value)if(!/[^a-zA-Z0-9]/.test(t.secret)){for(var r,a,i,s=d.querySelectorAll('iframe[data-secret="'+t.secret+'"]'),n=d.querySelectorAll('blockquote[data-secret="'+t.secret+'"]'),o=0;of;f++)if(e=j.eq(f),!h(e)){var l="__"+d.guid++,m=d.classes.raw.base+l,n=e.data(c+"-options"),o=a.extend(!0,{$el:e,guid:l,rawGuid:m,dotGuid:"."+m},b,"object"===a.type(n)?n:{});e.addClass(d.classes.raw.element).data(s,o),d.methods._construct.apply(e,[o].concat(Array.prototype.slice.call(arguments,i?1:0))),k=k.add(e)}for(f=0,g=k.length;g>f;f++)e=k.eq(f),d.methods._postConstruct.apply(e,[h(e)]);return j}function g(){d.functions.iterate.apply(this,[d.methods._destruct].concat(Array.prototype.slice.call(arguments,1))),this.removeClass(d.classes.raw.element).removeData(s)}function h(a){return a.data(s)}function i(b){if(this instanceof a){var c=d.methods[b];return"object"!==a.type(b)&&b?c&&0!==b.indexOf("_")?d.functions.iterate.apply(this,[c].concat(Array.prototype.slice.call(arguments,1))):this:f.apply(this,arguments)}}function k(c){var e=d.utilities[c]||d.utilities._initialize||!1;return e?e.apply(b,Array.prototype.slice.call(arguments,"object"===a.type(c)?0:1)):void 0}function n(b){d.defaults=a.extend(!0,d.defaults,b||{})}function q(b){for(var c=this,d=0,e=c.length;e>d;d++){var f=c.eq(d),g=h(f)||{};"undefined"!==a.type(g.$el)&&b.apply(f,[g].concat(Array.prototype.slice.call(arguments,1)))}return c}var r="fs-"+c,s="fs"+c.replace(/(^|\s)([a-z])/g,function(a,b,c){return b+c.toUpperCase()});return d.initialized=!1,d.priority=d.priority||10,d.classes=e("classes",r,o,d.classes),d.events=e("events",c,p,d.events),d.functions=a.extend({getData:h,iterate:q},l,d.functions),d.methods=a.extend(!0,{_setup:a.noop,_construct:a.noop,_postConstruct:a.noop,_destruct:a.noop,_resize:!1,destroy:g},d.methods),d.utilities=a.extend(!0,{_initialize:!1,_delegate:!1,defaults:n},d.utilities),d.widget&&(m.Conflicts.fn[c]=a.fn[c],a.fn[s]=i,m.DontConflict||(a.fn[c]=a.fn[s])),m.Conflicts[c]=a[c],a[s]=d.utilities._delegate||k,m.DontConflict||(a[c]=a[s]),d.namespace=c,d.namespaceClean=s,d.guid=0,d.methods._resize&&(m.ResizeHandlers.push({namespace:c,priority:d.priority,callback:d.methods._resize}),m.ResizeHandlers.sort(j)),d.methods._raf&&(m.RAFHandlers.push({namespace:c,priority:d.priority,callback:d.methods._raf}),m.RAFHandlers.sort(j)),d}(c,f),n.then(function(){d(c)}),m.Plugins[c]};var q=null,r=20;return m.$window.on("resize.fs",g),g(),i(),a(function(){m.$body=a("body"),n.resolve(),m.support.nativeMatchMedia=m.support.matchMedia&&!a("html").hasClass("no-matchmedia")}),p.clickTouchStart=p.click+" "+p.touchStart,f(),m}(jQuery,window,document); !function(a,b){"use strict";function c(a,c){if(c){a.$target=this.find(a.target),a.$check=a.target?a.$target:this,a.callback=c,a.styles=h(a.$check),a.timer=null;var d=a.$check.css(b.transition+"-duration"),f=parseFloat(d);b.support.transition&&d&&f?this.on(k.transitionEnd,a,e):a.timer=l.startTimer(a.timer,50,function(){g(a)},!0)}}function d(a){l.clearTimer(a.timer,!0),this.off(k.namespace)}function e(b){b.stopPropagation(),b.preventDefault();var c=b.data,d=b.originalEvent,e=c.target?c.$target:c.$el;c.property&&d.propertyName!==c.property||!a(d.target).is(e)||f(c)}function f(a){a.always||a.$el[j.namespaceClean]("destroy"),a.callback.apply(a.$el)}function g(a){var b=h(a.$check);i(a.styles,b)||f(a),a.styles=b}function h(b){var c,d,e,f={};if(b instanceof a&&(b=b[0]),m.getComputedStyle){c=m.getComputedStyle(b,null);for(var g=0,h=c.length;h>g;g++)d=c[g],e=c.getPropertyValue(d),f[d]=e}else if(b.currentStyle){c=b.currentStyle;for(d in c)c[d]&&(f[d]=c[d])}return f}function i(b,c){if(a.type(b)!==a.type(c))return!1;for(var d in b)if(!b.hasOwnProperty(d)||!c.hasOwnProperty(d)||b[d]!==c[d])return!1;return!0}var j=b.Plugin("transition",{widget:!0,defaults:{always:!1,property:null,target:null},methods:{_construct:c,_destruct:d,resolve:f}}),k=j.events,l=j.functions,m=b.window}(jQuery,Formstone); !function(a,b){"use strict";function c(){y.iterate.call(A,r)}function d(){A=a(v.base)}function e(b){b.youTubeGuid=0,b.$container=a('
        ').appendTo(this),this.addClass([w.base,b.customClass].join(" "));var c=b.source;b.source=null,g(b,c,!0),d()}function f(a){a.$container.remove(),this.removeClass([w.base,a.customClass].join(" ")).off(x.namespace),d()}function g(b,c,d){if(c!==b.source){if(b.source=c,b.responsive=!1,b.isYouTube=!1,"object"===a.type(c)&&"string"===a.type(c.video)){var e=c.video.match(/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/i);e&&e.length>=1&&(b.isYouTube=!0,b.videoId=e[1])}var f=!b.isYouTube&&"object"===a.type(c)&&(c.hasOwnProperty("mp4")||c.hasOwnProperty("ogg")||c.hasOwnProperty("webm"));if(b.video=b.isYouTube||f,b.playing=!1,b.isYouTube)b.playerReady=!1,b.posterLoaded=!1,k(b,c,d);else if("object"===a.type(c)&&c.hasOwnProperty("poster"))j(b,c,d);else{var g=c;if("object"===a.type(c)){var l,m=[],n=[];for(l in c)c.hasOwnProperty(l)&&n.push(l);n.sort(y.sortAsc);for(l in n)n.hasOwnProperty(l)&&m.push({width:parseInt(n[l]),url:c[n[l]],mq:window.matchMedia("(min-width: "+parseInt(n[l])+"px)")});b.responsive=!0,b.sources=m,g=h(b)}i(b,g,!1,d)}}else b.$el.trigger(x.loaded)}function h(a){var c=a.source;if(a.responsive){c=a.sources[0].url;for(var d in a.sources)a.sources.hasOwnProperty(d)&&(b.support.nativeMatchMedia?a.sources[d].mq.matches&&(c=a.sources[d].url):a.sources[d].width
        '),h=g.find("img"),i=c;h.one(x.load,function(){B&&g.addClass(w["native"]).css({backgroundImage:"url('"+i+"')"}),g.fsTransition({property:"opacity"},function(){d||l(b)}).css({opacity:1}),s(b),(!d||e)&&b.$el.trigger(x.loaded)}).attr("src",i),b.responsive&&g.addClass(w.responsive),b.$container.append(g),(h[0].complete||4===h[0].readyState)&&h.trigger(x.load),b.currentSource=i}function j(c,d,e){if(c.source&&c.source.poster&&(i(c,c.source.poster,!0,!0),e=!1),!b.isMobile){var f=[w.media,w.video,e!==!0?w.animated:""].join(" "),g='
        ';g+="'),c.source.mp4&&(g+=''),c.source.ogg&&(g+=''),g+="",g+="
        ";var h=a(g),j=h.find("video");j.one(x.loadedMetaData,function(){h.fsTransition({property:"opacity"},function(){l(c)}).css({opacity:1}),s(c),c.$el.trigger(x.loaded),c.autoPlay&&o(c)}),c.$container.append(h)}}function k(c,d,e){if(!c.videoId){var f=d.match(/^.*(?:youtu.be\/|v\/|e\/|u\/\w+\/|embed\/|v=)([^#\&\?]*).*/);c.videoId=f[1]}if(c.posterLoaded||(c.source.poster||(c.source.poster="//img.youtube.com/vi/"+c.videoId+"/0.jpg"),c.posterLoaded=!0,i(c,c.source.poster,!0,e),e=!1),!b.isMobile)if(a("script[src*='youtube.com/iframe_api']").length||a("head").append(''),C){var g=c.guid+"_"+c.youTubeGuid++,h=[w.media,w.embed,e!==!0?w.animated:""].join(" "),j='
        ';j+='
        ',j+="
        ";var k=a(j),m=a.extend(!0,{},{controls:0,rel:0,showinfo:0,wmode:"transparent",enablejsapi:1,version:3,playerapiid:g,loop:c.loop?1:0,autoplay:1,origin:z.location.protocol+"//"+z.location.host},c.youtubeOptions);c.$container.append(k),c.player&&(c.oldPlayer=c.player,c.player=null),c.player=new z.YT.Player(g,{videoId:c.videoId,playerVars:m,events:{onReady:function(){c.playerReady=!0,c.mute&&c.player.mute(),c.autoPlay&&c.player.playVideo()},onStateChange:function(a){c.playing||a.data!==z.YT.PlayerState.PLAYING?c.loop&&c.playing&&a.data===z.YT.PlayerState.ENDED&&c.player.playVideo():(c.playing=!0,c.autoPlay||c.player.pauseVideo(),k.fsTransition({property:"opacity"},function(){l(c)}).css({opacity:1}),s(c),c.$el.trigger(x.loaded)),c.$el.find(v.embed).addClass(w.ready)},onPlaybackQualityChange:function(){},onPlaybackRateChange:function(){},onError:function(){},onApiChange:function(){}}}),s(c)}else D.push({data:c,source:d})}function l(a){var b=a.$container.find(v.media);b.length>=1&&(b.not(":last").remove(),a.oldPlayer=null)}function m(a){var b=a.$container.find(v.media);b.length>=1&&b.fsTransition({property:"opacity"},function(){b.remove(),delete a.source}).css({opacity:0})}function n(a){if(a.video){if(a.isYouTube&&a.playerReady)a.player.pauseVideo();else{var b=a.$container.find("video");b.length&&b[0].pause()}a.playing=!1}}function o(a){if(a.video){if(a.isYouTube&&a.playerReady)a.player.playVideo();else{var b=a.$container.find("video");b.length&&b[0].play()}a.playing=!0}}function p(a){if(a.video){if(a.isYouTube&&a.playerReady)a.player.mute();else{var b=a.$container.find("video");b.length&&(b[0].muted=!0)}a.playing=!0}a.mute=!0}function q(a){if(a.video){if(a.isYouTube&&a.playerReady)a.player.unMute();else{var b=a.$container.find("video");b.length&&(b[0].muted=!1)}a.playing=!0}a.mute=!1}function r(a){if(a.responsive){var b=h(a);b!==a.currentSource?i(a,b,!1,!0):s(a)}else s(a)}function s(a){for(var b=a.$container.find(v.media),c=0,d=b.length;d>c;c++){var e=b.eq(c),f=a.isYouTube?"iframe":e.find("video").length?"video":"img",g=e.find(f);if(g.length&&("img"!==f||!B)){var h=a.$el.outerWidth(),i=a.$el.outerHeight(),j=t(a,g);a.width=j.width,a.height=j.height,a.left=0,a.top=0;var k=a.isYouTube?a.embedRatio:a.width/a.height;a.height=i,a.width=a.height*k,a.width 5) ? 5:(( rating < 0) ? 0:parseInt(rating)), half=(rating==filled||rating > 5||rating < 0) ? 0:1; wrap.find('span').each(function(index, el){ $(this).removeClass('dashicons-star-filled dashicons-star-half dashicons-star-empty'); if(index < filled){ $(this).addClass('dashicons-star-filled'); }else if(index==filled&&half==1){ $(this).addClass('dashicons-star-half'); }else{ $(this).addClass('dashicons-star-empty'); }}); }, star_rating: function(field){ var self=this, schema_id=$(field).closest('.aiosrs-rating-wrap').data('schema-id'), parent=$(field).closest('.aiosrs-star-rating-wrap'), index=$(field).data('index'); if(! parent.hasClass('disabled')){ self.update_stars(parent, index); parent.addClass('disabled'); $.ajax({ url: AIOSRS_Frontend.ajaxurl, type: 'POST', data: { action: 'aiosrs_user_rating', rating: index, schema_id: schema_id, post_id: AIOSRS_Frontend.post_id, nonce: AIOSRS_Frontend.user_rating_nonce }}).success(function(response){ if(response['success']==true){ var summary_wrap=parent.next('.aiosrs-rating-summary-wrap'), rating=response['rating'], avg_rating=response['rating-avg'], review_count=response['review-count']; summary_wrap.find('.aiosrs-rating').text(avg_rating); summary_wrap.find('.aiosrs-rating-count').text(review_count); if(parent.next('.success-msg').length==0){ parent.after(''+ AIOSRS_Frontend.success_msg +''); } setTimeout(function(){ parent.parent().find('.success-msg').remove(); parent.removeClass('disabled'); }, 5000); self.update_stars(parent, rating); }}); }} } $(function(){ WP_Schema_Pro_Frontend.init(); }); })(jQuery);